From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: From: Vladimir Davydov Subject: [RFC PATCH 09/12] box: connect to remote peers before starting local recovery Date: Wed, 6 Jun 2018 20:45:09 +0300 Message-Id: <8ab6c04781f60db37b4e3848605b631ff1c1b45b.1528305232.git.vdavydov.dev@gmail.com> In-Reply-To: References: In-Reply-To: References: To: kostja@tarantool.org Cc: tarantool-patches@freelists.org List-ID: box_sync_replication() can now be called before recovery, right after box_listen(). This is a step toward detecting if the instance fell too much behind its peers in the cluster and so needs to be rebootstrapped. Needed for #461 --- src/box/box.cc | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/src/box/box.cc b/src/box/box.cc index fce5ebb1..2ff9fb5f 100644 --- a/src/box/box.cc +++ b/src/box/box.cc @@ -1852,8 +1852,10 @@ box_cfg_xc(void) */ recovery_end_vclock(recovery, &replicaset.vclock); - if (wal_dir_lock >= 0) + if (wal_dir_lock >= 0) { box_listen(); + box_sync_replication(replication_connect_timeout, false); + } /* * recovery->vclock is needed by Vinyl to filter @@ -1911,6 +1913,7 @@ box_cfg_xc(void) */ vclock_copy(&replicaset.vclock, &recovery->vclock); box_listen(); + box_sync_replication(replication_connect_timeout, false); } recovery_finalize(recovery); engine_end_recovery_xc(); @@ -1925,11 +1928,6 @@ box_cfg_xc(void) /* Clear the pointer to journal before it goes out of scope */ journal_set(NULL); - - title("orphan"); - - /* Wait for the cluster to start up */ - box_sync_replication(replication_connect_timeout, false); } else { if (!tt_uuid_is_nil(&instance_uuid)) INSTANCE_UUID = instance_uuid; @@ -1941,8 +1939,6 @@ box_cfg_xc(void) */ box_listen(); - title("orphan"); - /* * Wait for the cluster to start up. * @@ -1978,6 +1974,8 @@ box_cfg_xc(void) rmean_cleanup(rmean_box); + title("orphan"); + /* * If this instance is a leader of a newly bootstrapped * cluster, it is uptodate by definition so leave the -- 2.11.0