From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: From: Vladimir Davydov Subject: [PATCH 1/2] replication: fix log message in case of sync failure Date: Thu, 24 May 2018 21:00:27 +0300 Message-Id: In-Reply-To: References: In-Reply-To: References: To: kostja@tarantool.org Cc: tarantool-patches@freelists.org List-ID: replicaset_sync() returns not only if the instance synchronized to connected replicas, but also if some replicas have disconnected and the quorum can't be formed any more. Nevertheless, it always prints that sync has been completed. Fix it. See #3422 --- src/box/replication.cc | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/src/box/replication.cc b/src/box/replication.cc index 7bdefccf..6d90ee5f 100644 --- a/src/box/replication.cc +++ b/src/box/replication.cc @@ -636,18 +636,10 @@ replicaset_sync(void) { int quorum = replicaset_quorum(); - if (quorum > 0) - say_verbose("synchronizing with %d replicas", quorum); - - if (replicaset.applier.connected < quorum) { - /* - * Not enough replicas connected to form a quorum. - * Do not stall configuration, leave the instance - * in 'orphan' state. - */ - say_crit("entering orphan mode"); + if (quorum == 0) return; - } + + say_verbose("synchronizing with %d replicas", quorum); /* * Wait until all connected replicas synchronize up to @@ -657,10 +649,18 @@ replicaset_sync(void) replicaset.applier.connected >= quorum) fiber_cond_wait(&replicaset.applier.cond); - if (quorum > 0) { - say_crit("replica set sync complete, quorum of %d " - "replicas formed", quorum); + if (replicaset.applier.synced < quorum) { + /* + * Not enough replicas connected to form a quorum. + * Do not stall configuration, leave the instance + * in 'orphan' state. + */ + say_crit("entering orphan mode"); + return; } + + say_crit("replica set sync complete, quorum of %d " + "replicas formed", quorum); } void -- 2.11.0