Pavlin Radoslavov

Adding-back "Wait for a raft quorum + logging a message to inform about the wait"

This reverts commit 17319764.

Change-Id: I6e5e4d5ef5e06930c80ca96a4e1e9de7d71eee70
......@@ -224,16 +224,20 @@ public class DatabaseManager implements DatabaseService, DatabaseAdminService {
clusterEventListener = new InternalClusterEventListener();
clusterService.addListener(clusterEventListener);
if (clusterService.getNodes().size() < clusterConfig.getMembers().size()) {
final int raftClusterSize = clusterConfig.getMembers().size();
final int raftClusterQuorumSize = (int) (Math.floor(raftClusterSize / 2)) + 1;
if (clusterService.getNodes().size() < raftClusterQuorumSize) {
// current cluster size smaller then expected
try {
if (!clusterEventLatch.await(120, TimeUnit.SECONDS)) {
final int waitTimeSec = 120;
log.info("Waiting for a maximum of {}s for raft cluster quorum to boot up...", waitTimeSec);
if (!clusterEventLatch.await(waitTimeSec, TimeUnit.SECONDS)) {
log.info("Starting with {}/{} nodes cluster",
clusterService.getNodes().size(),
clusterConfig.getMembers().size());
raftClusterSize);
}
} catch (InterruptedException e) {
log.info("Interrupted waiting for others", e);
log.info("Interrupted waiting for raft quorum.", e);
}
}
}
......