Skip to content

Commit

Permalink
Add issue about vshard storages marked as ALL_RW (#2156)
Browse files Browse the repository at this point in the history
* Add issue about vshard storages marked as ALL_RW
  • Loading branch information
yngvar-antonsson authored Nov 21, 2023
1 parent 7dc7caf commit 7cb942c
Show file tree
Hide file tree
Showing 7 changed files with 48 additions and 10 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ Added

- Filter param to Lua API ``get_servers`` to filter instances.

- new issue about vshard storages marked as ``ALL_RW``.

-------------------------------------------------------------------------------
[2.8.4] - 2023-10-31
-------------------------------------------------------------------------------
Expand Down
6 changes: 6 additions & 0 deletions cartridge/issues.lua
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,12 @@
-- * warning: "Advertise URI (...) differs from clusterwide config (...)";
-- * warning: "Configuring roles is stuck on ... and hangs for ... so far";
--
-- Vshard:
--
-- * various vshard alerts (see vshard docs for details);
-- * warning: "Group "..." wasn't bootstrapped: ...";
-- * warning: Vshard storages in replicaset %s marked as "all writable".
--
-- Alien members:
--
-- * warning: "Instance ... with alien uuid is in the membership" -
Expand Down
14 changes: 13 additions & 1 deletion cartridge/roles/vshard-storage.lua
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,12 @@ hotreload.whitelist_globals({
vars:new('vshard_cfg')
vars:new('instance_uuid')
vars:new('replicaset_uuid')
vars:new('issues', {})
local _G_vshard_backup

local function apply_config(conf, _)
local function apply_config(conf, opts)
checks('table', {is_master = 'boolean'})
vars.issues = {}

local my_replicaset = conf.topology.replicasets[vars.replicaset_uuid]
local group_name = my_replicaset.vshard_group or 'default'
Expand All @@ -34,6 +36,15 @@ local function apply_config(conf, _)
vshard_cfg.listen = box.cfg.listen
vshard_cfg.replication = box.cfg.replication

if my_replicaset.all_rw and opts.is_master then
table.insert(vars.issues, {
level = 'warning',
topic = 'vshard',
message = ([[Vshard storages in replicaset %s marked as "all writable". ]] ..
[[This might not work as expected.]]):format(vars.replicaset_uuid),
})
end

if utils.deepcmp(vshard_cfg, vars.vshard_cfg) then
-- No reconfiguration required, skip it
return
Expand Down Expand Up @@ -101,4 +112,5 @@ return {
on_apply_config = on_apply_config,
init = init,
stop = stop,
get_issues = function() return vars.issues end,
}
19 changes: 19 additions & 0 deletions rst/cartridge_admin.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1379,6 +1379,14 @@ Cartridge displays cluster and instances issues in WebUI:

|nbsp|

* Vshard:

* various vshard alerts (see vshard docs for details);

* **warning**: warning: "Group "..." wasn't bootstrapped: ...";

* **warning**: Vshard storages in replicaset %s marked as "all writable".

* Alien members:

* **warning**: "Instance ... with alien uuid is in the membership" --
Expand All @@ -1390,10 +1398,21 @@ Cartridge displays cluster and instances issues in WebUI:

|nbsp|

* Expelled instances:

* **warning**: "Replicaset ... has expelled instance ... in box.space._cluster" -
when instance was expelled from replicaset, but still remains in box.space._cluster;

* Deprecated space format:

* **warning**: "Instance ... has spaces with deprecated format: space1, ..."

* Raft issues:

* **warning**: "Raft leader idle is 10.000 on ... .
Is raft leader alive and connection is healthy?"


* Custom issues (defined by user):

* Custom roles can announce more issues with their own level, topic
Expand Down
7 changes: 7 additions & 0 deletions test/integration/api_edit_test.lua
Original file line number Diff line number Diff line change
Expand Up @@ -313,4 +313,11 @@ end

function g.test_all_rw_true()
test_all_rw(true)
helpers.retrying({}, function()
t.assert_equals(
helpers.list_cluster_issues(g.cluster.main_server)[1].message,
('Vshard storages in replicaset %s '):format(helpers.uuid('b'))..
'marked as "all writable". This might not work as expected.'
)
end)
end
3 changes: 1 addition & 2 deletions test/integration/api_query_test.lua
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ g.before_all(function()
}, {
uuid = helpers.uuid('b'),
roles = {'vshard-storage'},
all_rw = true,
servers = {
{
alias = 'storage',
Expand Down Expand Up @@ -479,7 +478,7 @@ function g.test_replicasets()
master = {uuid = helpers.uuid('b', 'b', 1)},
active_master = {uuid = helpers.uuid('b', 'b', 1)},
weight = 1,
all_rw = true,
all_rw = false,
servers = {
{uri = 'localhost:13302', priority = 1},
{uri = 'localhost:13304', priority = 2},
Expand Down
7 changes: 0 additions & 7 deletions webui/cypress/integration/bootstrap.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -186,9 +186,6 @@ describe('Replicaset configuration & Bootstrap Vshard', () => {
cy.get('form input[value="vshard-router"]').check({ force: true }).should('be.checked');
cy.get('form input[value="vshard-storage"]').should('not.be.checked');

cy.get('form input[name="all_rw"]').check({ force: true });
cy.get('form input[name="all_rw"]').should('be.checked');

cy.get('.meta-test__EditReplicasetSaveBtn').click();
cy.get('#root').contains('test-router');

Expand Down Expand Up @@ -243,12 +240,9 @@ describe('Replicaset configuration & Bootstrap Vshard', () => {
cy.get('form input[value="vshard-router"]').should('not.be.checked');
cy.get('form input[value="vshard-storage"]').should('be.checked');

cy.get('form input[name="all_rw"]').check({ force: true }).should('be.checked');

cy.get('.meta-test__CreateReplicaSetBtn').click();

cy.get('#root').contains('test-storage');
cy.get('.meta-test__ReplicasetList_allRw_enabled').should('have.length', 2);

// Check health state
cy.get('section').eq(0).contains('Total unconfigured instances1');
Expand Down Expand Up @@ -283,7 +277,6 @@ describe('Replicaset configuration & Bootstrap Vshard', () => {
cy.get('.meta-test__EditReplicasetSaveBtn').should('be.enabled');

cy.get('form input[name="alias"]').type('{selectall}edited-storage').should('have.value', 'edited-storage');
cy.get('form input[name="all_rw"]').uncheck({ force: true }).should('not.be.checked');

cy.get('form input[value="myrole"]').uncheck({ force: true }).should('not.be.checked');
cy.get('form input[value="myrole-dependency"]').should('be.enabled').should('not.be.checked');
Expand Down

0 comments on commit 7cb942c

Please sign in to comment.