From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: From: Vladimir Davydov Subject: [PATCH v4 0/3] Replica rejoin Date: Sat, 21 Jul 2018 15:38:11 +0300 Message-Id: To: kostja@tarantool.org Cc: tarantool-patches@freelists.org List-ID: After this patch set is applied, an instance will try to detect if it fell too much behind its peers in the cluster and so needs to be rebootstrapped. If it does, it will skip local recovery and instead proceed to bootstrap from a remote master. Old files (xlog, snap) are not deleted during rebootstrap. They will be removed by gc as usual. https://github.com/tarantool/tarantool/issues/461 https://github.com/tarantool/tarantool/commits/dv/gh-461-replica-rejoin Changes in v4: - Rebase on top of the latest 1.10 and remove merged patches. - Log everything that affects rebootstrap decision making. - Rebootstrap an instance only if it can't follow *all* masters, not just *any* of them, as it used to be. v3: https://www.freelists.org/post/tarantool-patches/PATCH-v3-0011-Replica-rejoin Changes in v3: - Remove merged patches, add some new ones. - Rebase on top of the latest 1.10: this required patching gc to make it track vclocks instead of signatures so that it could report the vclock of the oldest xlog stored on the instance. - Follow-up on the recently committed patch for recovery subsystem: add some comments and remove double scanning of the WAL directory. - Introduce a new IPROTO command, IPROTO_REQUEST_STATUS, to be used instead of IPROTO_REQUEST_VOTE; send a map in reply to this command. Rationale: a map is more flexible and can be extended. In particular, we can use the very same message for inquiring the oldest vclock stored on the master to detect if a replica needs to be rejoined, instead of introducing a new IPROTO command, as we did in v2. - Do NOT rebootstrap a replica if it has some data that is absent on the master. Rationale: we don't want to lose ANY data by rejoining a replica; besides, if a replica's vclock is incomparable with the master's, xdir_scan may break. v2: https://www.freelists.org/post/tarantool-patches/PATCH-v2-0011-Replica-rejoin Changes in v2: - Implement rebootstrap support for vinyl engine. - Call recover_remaining_wals() explicitly after recovery_stop_local() as suggested by @kostja. - Add comment to memtx_engine_new() explaining why we need to init INSTANCE_UUID before proceeding to local recovery. v1: https://www.freelists.org/post/tarantool-patches/RFC-PATCH-0012-Replica-rejoin Vladimir Davydov (3): replication: rebootstrap instance on startup if it fell behind vinyl: simplify vylog recovery from backup vinyl: implement rebootstrap support src/box/box.cc | 9 ++ src/box/relay.cc | 3 + src/box/replication.cc | 59 +++++++ src/box/replication.h | 9 ++ src/box/vy_log.c | 190 +++++++++++++++++------ src/box/vy_log.h | 34 ++++ src/errinj.h | 1 + test/box/errinj.result | 6 +- test/replication/replica_rejoin.result | 250 ++++++++++++++++++++++++++++++ test/replication/replica_rejoin.test.lua | 91 +++++++++++ test/vinyl/replica_rejoin.lua | 13 ++ test/vinyl/replica_rejoin.result | 257 +++++++++++++++++++++++++++++++ test/vinyl/replica_rejoin.test.lua | 88 +++++++++++ test/vinyl/suite.ini | 2 +- 14 files changed, 965 insertions(+), 47 deletions(-) create mode 100644 test/replication/replica_rejoin.result create mode 100644 test/replication/replica_rejoin.test.lua create mode 100644 test/vinyl/replica_rejoin.lua create mode 100644 test/vinyl/replica_rejoin.result create mode 100644 test/vinyl/replica_rejoin.test.lua -- 2.11.0