From: Vladimir Davydov <vdavydov.dev@gmail.com> To: kostja@tarantool.org Cc: tarantool-patches@freelists.org Subject: [PATCH 01/13] vinyl: fix master crash on replica join failure Date: Thu, 4 Oct 2018 20:20:03 +0300 [thread overview] Message-ID: <5bd6ef8f21fe114260fe466b55a0f124b69f9a88.1538671546.git.vdavydov.dev@gmail.com> (raw) In-Reply-To: <cover.1538671546.git.vdavydov.dev@gmail.com> In-Reply-To: <cover.1538671546.git.vdavydov.dev@gmail.com> This patch fixes a trivial error on vy_send_range() error path which results in a master crash in case a file needed to join a replica is missing or corrupted. See #3708 --- src/box/vinyl.c | 6 +++--- test/vinyl/errinj.result | 51 ++++++++++++++++++++++++++++++++++++++++++++++ test/vinyl/errinj.test.lua | 18 ++++++++++++++++ 3 files changed, 72 insertions(+), 3 deletions(-) diff --git a/src/box/vinyl.c b/src/box/vinyl.c index 2d0360c1..0cd7b188 100644 --- a/src/box/vinyl.c +++ b/src/box/vinyl.c @@ -2983,13 +2983,13 @@ vy_send_range(struct vy_join_ctx *ctx, vy_send_range_f, NULL, TIMEOUT_INFINITY); fiber_set_cancellable(cancellable); +out_delete_wi: + ctx->wi->iface->close(ctx->wi); + ctx->wi = NULL; out_delete_slices: rlist_foreach_entry_safe(slice, &ctx->slices, in_join, tmp) vy_slice_delete(slice); rlist_create(&ctx->slices); -out_delete_wi: - ctx->wi->iface->close(ctx->wi); - ctx->wi = NULL; out: return rc; } diff --git a/test/vinyl/errinj.result b/test/vinyl/errinj.result index b4dc5b69..63d14c61 100644 --- a/test/vinyl/errinj.result +++ b/test/vinyl/errinj.result @@ -2232,3 +2232,54 @@ test_run:cmd("clear filter") --- - true ... +-- +-- Check that an instance doesn't crash if a run file needed for +-- joining a replica is corrupted (see gh-3708). +-- +s = box.schema.space.create('test', {engine = 'vinyl'}) +--- +... +_ = s:create_index('pk') +--- +... +s:replace{1, 2, 3} +--- +- [1, 2, 3] +... +box.snapshot() +--- +- ok +... +box.schema.user.grant('guest', 'replication') +--- +... +errinj.set('ERRINJ_VYRUN_INDEX_GARBAGE', true) +--- +- ok +... +test_run:cmd("create server replica with rpl_master=default, script='replication/replica.lua'") +--- +- true +... +test_run:cmd("start server replica with crash_expected=True") +--- +- false +... +test_run:cmd("cleanup server replica") +--- +- true +... +test_run:cmd("delete server replica") +--- +- true +... +errinj.set('ERRINJ_VYRUN_INDEX_GARBAGE', false) +--- +- ok +... +box.schema.user.revoke('guest', 'replication') +--- +... +s:drop() +--- +... diff --git a/test/vinyl/errinj.test.lua b/test/vinyl/errinj.test.lua index e82b6aee..b6f697d3 100644 --- a/test/vinyl/errinj.test.lua +++ b/test/vinyl/errinj.test.lua @@ -882,3 +882,21 @@ i:stat().disk.compact.queue -- none s:drop() test_run:cmd("clear filter") + +-- +-- Check that an instance doesn't crash if a run file needed for +-- joining a replica is corrupted (see gh-3708). +-- +s = box.schema.space.create('test', {engine = 'vinyl'}) +_ = s:create_index('pk') +s:replace{1, 2, 3} +box.snapshot() +box.schema.user.grant('guest', 'replication') +errinj.set('ERRINJ_VYRUN_INDEX_GARBAGE', true) +test_run:cmd("create server replica with rpl_master=default, script='replication/replica.lua'") +test_run:cmd("start server replica with crash_expected=True") +test_run:cmd("cleanup server replica") +test_run:cmd("delete server replica") +errinj.set('ERRINJ_VYRUN_INDEX_GARBAGE', false) +box.schema.user.revoke('guest', 'replication') +s:drop() -- 2.11.0
next prev parent reply other threads:[~2018-10-04 17:20 UTC|newest] Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top 2018-10-04 17:20 [PATCH 00/13] box: garbage collection refactoring and fixes Vladimir Davydov 2018-10-04 17:20 ` Vladimir Davydov [this message] 2018-10-04 21:43 ` [PATCH 01/13] vinyl: fix master crash on replica join failure Konstantin Osipov 2018-10-04 17:20 ` [PATCH 02/13] vinyl: force deletion of runs left from unfinished indexes on restart Vladimir Davydov 2018-10-04 21:44 ` Konstantin Osipov 2018-10-04 17:20 ` [PATCH 03/13] gc: make gc_consumer and gc_state structs transparent Vladimir Davydov 2018-10-04 21:47 ` Konstantin Osipov 2018-10-04 17:20 ` [PATCH 04/13] gc: use fixed length buffer for storing consumer name Vladimir Davydov 2018-10-04 21:47 ` Konstantin Osipov 2018-10-04 17:20 ` [PATCH 05/13] gc: fold gc_consumer_new and gc_consumer_delete Vladimir Davydov 2018-10-04 21:50 ` Konstantin Osipov 2018-10-05 8:56 ` Vladimir Davydov 2018-10-04 17:20 ` [PATCH 06/13] gc: format consumer name in gc_consumer_register Vladimir Davydov 2018-10-04 21:50 ` Konstantin Osipov 2018-10-04 17:20 ` [PATCH 07/13] gc: rename checkpoint_count to min_checkpoint_count Vladimir Davydov 2018-10-04 21:51 ` Konstantin Osipov 2018-10-04 17:20 ` [PATCH 08/13] gc: keep track of available checkpoints Vladimir Davydov 2018-10-04 21:59 ` Konstantin Osipov 2018-10-05 8:50 ` Vladimir Davydov 2018-10-04 17:20 ` [PATCH 09/13] gc: cleanup garbage collection procedure Vladimir Davydov 2018-10-04 22:00 ` Konstantin Osipov 2018-10-04 17:20 ` [PATCH 10/13] gc: improve box.info.gc output Vladimir Davydov 2018-10-04 22:01 ` Konstantin Osipov 2018-10-04 17:20 ` [PATCH 11/13] gc: separate checkpoint references from wal consumers Vladimir Davydov 2018-10-04 22:05 ` Konstantin Osipov 2018-10-04 17:20 ` [PATCH 12/13] gc: call gc_run unconditionally when consumer is advanced Vladimir Davydov 2018-10-04 22:26 ` Konstantin Osipov 2018-10-04 17:20 ` [PATCH 13/13] replication: ref checkpoint needed to join replica Vladimir Davydov 2018-10-04 22:27 ` Konstantin Osipov 2018-10-05 17:03 ` [PATCH 00/13] box: garbage collection refactoring and fixes Vladimir Davydov
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=5bd6ef8f21fe114260fe466b55a0f124b69f9a88.1538671546.git.vdavydov.dev@gmail.com \ --to=vdavydov.dev@gmail.com \ --cc=kostja@tarantool.org \ --cc=tarantool-patches@freelists.org \ --subject='Re: [PATCH 01/13] vinyl: fix master crash on replica join failure' \ /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