aboutsummaryrefslogtreecommitdiffstats
path: root/zookeeper-server
diff options
context:
space:
mode:
authorJon Marius Venstad <venstad@gmail.com>2022-03-09 14:04:05 +0100
committerJon Marius Venstad <venstad@gmail.com>2022-03-09 14:04:05 +0100
commita18996a3cb90a10f9efd53beb9ea68524db5b60f (patch)
treeae7389aac7f8c3cd9483fc268dcb995993f67f46 /zookeeper-server
parent7743992d1dd55b635a297ad97546d4fbfd5ce23f (diff)
Wait exactly 3 minutes for new servers
Diffstat (limited to 'zookeeper-server')
-rw-r--r--zookeeper-server/zookeeper-server-common/src/main/java/com/yahoo/vespa/zookeeper/Reconfigurer.java10
1 files changed, 4 insertions, 6 deletions
diff --git a/zookeeper-server/zookeeper-server-common/src/main/java/com/yahoo/vespa/zookeeper/Reconfigurer.java b/zookeeper-server/zookeeper-server-common/src/main/java/com/yahoo/vespa/zookeeper/Reconfigurer.java
index 604419c063d..389df340ca7 100644
--- a/zookeeper-server/zookeeper-server-common/src/main/java/com/yahoo/vespa/zookeeper/Reconfigurer.java
+++ b/zookeeper-server/zookeeper-server-common/src/main/java/com/yahoo/vespa/zookeeper/Reconfigurer.java
@@ -29,8 +29,7 @@ public class Reconfigurer extends AbstractComponent {
private static final Logger log = java.util.logging.Logger.getLogger(Reconfigurer.class.getName());
- private static final Duration MIN_TIMEOUT = Duration.ofMinutes(3);
- private static final Duration NODE_TIMEOUT = Duration.ofMinutes(1);
+ private static final Duration TIMEOUT = Duration.ofMinutes(3);
private final ExponentialBackoff backoff = new ExponentialBackoff(Duration.ofSeconds(1), Duration.ofSeconds(10));
private final VespaZooKeeperAdmin vespaZooKeeperAdmin;
@@ -95,7 +94,7 @@ public class Reconfigurer extends AbstractComponent {
"\nServers in new config:" + servers(newConfig));
String connectionSpec = localConnectionSpec(activeConfig);
Instant now = Instant.now();
- Duration reconfigTimeout = reconfigTimeout(newConfig.server().size());
+ Duration reconfigTimeout = reconfigTimeout();
Instant end = now.plus(reconfigTimeout);
// Loop reconfiguring since we might need to wait until another reconfiguration is finished before we can succeed
for (int attempt = 1; now.isBefore(end); attempt++) {
@@ -129,11 +128,10 @@ public class Reconfigurer extends AbstractComponent {
Process.logAndDie("Reconfiguration did not complete within timeout " + reconfigTimeout + ". Forcing container shutdown.");
}
- /** Returns the timeout to use for the given joining server count */
- private static Duration reconfigTimeout(int joiningServers) {
+ private static Duration reconfigTimeout() {
// For reconfig to succeed, the current and resulting ensembles must have a majority. When an ensemble grows and
// the joining servers outnumber the existing ones, we have to wait for enough of them to start to have a majority.
- return Duration.ofMillis(Math.max(joiningServers * NODE_TIMEOUT.toMillis(), MIN_TIMEOUT.toMillis()));
+ return TIMEOUT;
}
private static String localConnectionSpec(ZookeeperServerConfig config) {