Adding-back "Wait for a raft quorum + logging a message to inform about the wait"
This reverts commit 17319764e20309e9be9c00ffe15ad76d22f8a757.
Change-Id: I6e5e4d5ef5e06930c80ca96a4e1e9de7d71eee70
diff --git a/core/store/dist/src/main/java/org/onlab/onos/store/service/impl/DatabaseManager.java b/core/store/dist/src/main/java/org/onlab/onos/store/service/impl/DatabaseManager.java
index c3494d9..35b6c98 100644
--- a/core/store/dist/src/main/java/org/onlab/onos/store/service/impl/DatabaseManager.java
+++ b/core/store/dist/src/main/java/org/onlab/onos/store/service/impl/DatabaseManager.java
@@ -224,16 +224,20 @@
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);
}
}
}