From: Serge Petrenko <sergepetrenko@tarantool.org> To: Vladislav Shpilevoy <v.shpilevoy@tarantool.org>, gorcunov@gmail.com Cc: tarantool-patches@dev.tarantool.org Subject: Re: [Tarantool-patches] [PATCH v2] box: make instace ro while limbo is not empty Date: Wed, 2 Dec 2020 11:10:25 +0300 [thread overview] Message-ID: <9ebaf301-f9ab-5f02-ada0-c67f37fbf4dd@tarantool.org> (raw) In-Reply-To: <e8e1ba2b-676c-524c-b1be-f5fa7ee61abc@tarantool.org> 02.12.2020 01:25, Vladislav Shpilevoy пишет: > Pushed to master and 2.6. > > Could you please backport it to 2.5 in a new branch? It seems > we need a test which wouldn't depend on elections anyhow. > Because we don't have them in 2.5. No problem. Here's the branch: sp/gh-5440-2.5 I had to cherry pick your commit introducing is_ro_summary, since it wasn't in 2.5 I've also made a test for read-only limbo without elections. Please, push it to 2.6 and master as well. I think a proper test won't hurt there. The test's also on the branch. Pasting it here just in case. ============================================================ commit 9d14706bacbd62afd474af7bb6d00f675241010e Author: Serge Petrenko <sergepetrenko@tarantool.org> Date: Wed Dec 2 11:02:07 2020 +0300 test: add tests for ro on non-empty limbo Follow-up #5440 diff --git a/test/replication/gh-5440-qsync-ro.result b/test/replication/gh-5440-qsync-ro.result new file mode 100644 index 000000000..1ece26a42 --- /dev/null +++ b/test/replication/gh-5440-qsync-ro.result @@ -0,0 +1,133 @@ +-- test-run result file version 2 +-- +-- gh-5440 everyone but the limbo owner is read-only on non-empty limbo. +-- +env = require('test_run') + | --- + | ... +test_run = env.new() + | --- + | ... +fiber = require('fiber') + | --- + | ... + +box.schema.user.grant('guest', 'replication') + | --- + | ... +test_run:cmd('create server replica with rpl_master=default, script="replication/replica.lua"') + | --- + | - true + | ... +test_run:cmd('start server replica with wait=True, wait_load=True') + | --- + | - true + | ... + +_ = box.schema.space.create('test', {is_sync=true}) + | --- + | ... +_ = box.space.test:create_index('pk') + | --- + | ... + +old_synchro_quorum = box.cfg.replication_synchro_quorum + | --- + | ... +old_synchro_timeout = box.cfg.replication_synchro_timeout + | --- + | ... + +-- Make sure that the master stalls on commit leaving the limbo non-empty. +box.cfg{replication_synchro_quorum=3, replication_synchro_timeout=1000} + | --- + | ... + +f = fiber.new(function() box.space.test:insert{1} end) + | --- + | ... +f:status() + | --- + | - suspended + | ... + +-- Wait till replica's limbo is non-empty. +test_run:wait_lsn('replica', 'default') + | --- + | ... +test_run:cmd('switch replica') + | --- + | - true + | ... + +box.info.ro + | --- + | - true + | ... +box.space.test:insert{2} + | --- + | - error: Can't modify data because this instance is in read-only mode. + | ... +success = false + | --- + | ... +f = require('fiber').new(function() box.ctl.wait_rw() success = true end) + | --- + | ... +f:status() + | --- + | - suspended + | ... + +test_run:cmd('switch default') + | --- + | - true + | ... + +-- Empty the limbo. +box.cfg{replication_synchro_quorum=2} + | --- + | ... + +test_run:cmd('switch replica') + | --- + | - true + | ... + +test_run:wait_cond(function() return success end) + | --- + | - true + | ... +box.info.ro + | --- + | - false + | ... +-- Should succeed now. +box.space.test:insert{2} + | --- + | - [2] + | ... + +-- Cleanup. +test_run:cmd('switch default') + | --- + | - true + | ... +box.cfg{replication_synchro_quorum=old_synchro_quorum,\ + replication_synchro_timeout=old_synchro_timeout} + | --- + | ... +box.space.test:drop() + | --- + | ... +test_run:cmd('stop server replica') + | --- + | - true + | ... +test_run:cmd('delete server replica') + | --- + | - true + | ... +box.schema.user.revoke('guest', 'replication') + | --- + | ... diff --git a/test/replication/gh-5440-qsync-ro.test.lua b/test/replication/gh-5440-qsync-ro.test.lua new file mode 100644 index 000000000..d63ec9c1e --- /dev/null +++ b/test/replication/gh-5440-qsync-ro.test.lua @@ -0,0 +1,53 @@ +-- +-- gh-5440 everyone but the limbo owner is read-only on non-empty limbo. +-- +env = require('test_run') +test_run = env.new() +fiber = require('fiber') + +box.schema.user.grant('guest', 'replication') +test_run:cmd('create server replica with rpl_master=default, script="replication/replica.lua"') +test_run:cmd('start server replica with wait=True, wait_load=True') + +_ = box.schema.space.create('test', {is_sync=true}) +_ = box.space.test:create_index('pk') + +old_synchro_quorum = box.cfg.replication_synchro_quorum +old_synchro_timeout = box.cfg.replication_synchro_timeout + +-- Make sure that the master stalls on commit leaving the limbo non-empty. +box.cfg{replication_synchro_quorum=3, replication_synchro_timeout=1000} + +f = fiber.new(function() box.space.test:insert{1} end) +f:status() + +-- Wait till replica's limbo is non-empty. +test_run:wait_lsn('replica', 'default') +test_run:cmd('switch replica') + +box.info.ro +box.space.test:insert{2} +success = false +f = require('fiber').new(function() box.ctl.wait_rw() success = true end) +f:status() + +test_run:cmd('switch default') + +-- Empty the limbo. +box.cfg{replication_synchro_quorum=2} + +test_run:cmd('switch replica') + +test_run:wait_cond(function() return success end) +box.info.ro +-- Should succeed now. +box.space.test:insert{2} + +-- Cleanup. +test_run:cmd('switch default') +box.cfg{replication_synchro_quorum=old_synchro_quorum,\ + replication_synchro_timeout=old_synchro_timeout} +box.space.test:drop() +test_run:cmd('stop server replica') +test_run:cmd('delete server replica') +box.schema.user.revoke('guest', 'replication') diff --git a/test/replication/suite.cfg b/test/replication/suite.cfg index a862f5a97..d01f0023b 100644 --- a/test/replication/suite.cfg +++ b/test/replication/suite.cfg @@ -32,6 +32,7 @@ "gh-4739-vclock-assert.test.lua": {}, "gh-4730-applier-rollback.test.lua": {}, "gh-4928-tx-boundaries.test.lua": {}, + "gh-5440-qsync-ro.test.lua": {}, "*": { "memtx": {"engine": "memtx"}, "vinyl": {"engine": "vinyl"} -- Serge Petrenko
next prev parent reply other threads:[~2020-12-02 8:10 UTC|newest] Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top 2020-11-30 9:35 Serge Petrenko 2020-11-30 9:41 ` Serge Petrenko 2020-11-30 21:22 ` Vladislav Shpilevoy 2020-12-01 8:46 ` Serge Petrenko 2020-12-01 11:06 ` Alexander V. Tikhonov 2020-12-01 22:25 ` Vladislav Shpilevoy 2020-12-02 8:10 ` Serge Petrenko [this message] 2020-12-02 21:38 ` Vladislav Shpilevoy 2020-12-02 21:39 ` Vladislav Shpilevoy 2020-12-03 21:21 ` Vladislav Shpilevoy 2020-12-03 12:44 ` Alexander V. Tikhonov
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=9ebaf301-f9ab-5f02-ada0-c67f37fbf4dd@tarantool.org \ --to=sergepetrenko@tarantool.org \ --cc=gorcunov@gmail.com \ --cc=tarantool-patches@dev.tarantool.org \ --cc=v.shpilevoy@tarantool.org \ --subject='Re: [Tarantool-patches] [PATCH v2] box: make instace ro while limbo is not empty' \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: link
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox