diff --git a/src/box/box.cc b/src/box/box.cc index 4cf7dd13d0b12e078b2133aa69623bb59917f43b..e3eb2738f379184c37520982259eaa8db14c18e5 100644 --- a/src/box/box.cc +++ b/src/box/box.cc @@ -1925,13 +1925,13 @@ box_cfg_xc(void) /* Follow replica */ replicaset_follow(); - say_info("ready to accept requests"); - fiber_gc(); is_box_configured = true; if (!is_bootstrap_leader) replicaset_sync(); + + say_info("ready to accept requests"); } void diff --git a/src/box/replication.cc b/src/box/replication.cc index 0b770c9131c63ecb8c2d9be27d51ee4f04947c06..89e9eb4a5cb89860ef295729ef56a1ad5ed51836 100644 --- a/src/box/replication.cc +++ b/src/box/replication.cc @@ -520,6 +520,7 @@ replicaset_connect(struct applier **appliers, int count, replicaset_update(appliers, count); return; } + say_verbose("connecting to %d replicas", count); /* * Simultaneously connect to remote peers to receive their UUIDs @@ -564,9 +565,13 @@ replicaset_connect(struct applier **appliers, int count, timeout -= ev_monotonic_now(loop()) - wait_start; } if (state.connected < count) { + say_crit("failed to connect to %d out of %d replicas", + count - state.connected, count); /* Timeout or connection failure. */ if (connect_all) goto error; + } else { + say_verbose("connected to %d replicas", state.connected); } for (int i = 0; i < count; i++) { @@ -631,29 +636,41 @@ 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"); return; } /* - * Wait until a quorum is formed. Abort waiting if - * a quorum cannot be formed because of errors. + * Wait until all connected replicas synchronize up to + * replication_sync_lag */ while (replicaset.applier.synced < quorum && 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); + } } void replicaset_check_quorum(void) { - if (replicaset.applier.synced >= replicaset_quorum()) + if (replicaset.applier.synced >= replicaset_quorum()) { + if (replicaset_quorum() > 0) + say_crit("leaving orphan mode"); box_clear_orphan(); + } } void