diff options
author | Harald Musum <musum@verizonmedia.com> | 2021-07-10 16:58:24 +0200 |
---|---|---|
committer | Harald Musum <musum@verizonmedia.com> | 2021-07-10 16:58:24 +0200 |
commit | 51e10d722c91df4b22cf350226a88f3f03796aa5 (patch) | |
tree | f0f792805216ab1d0b4adb039efade97f4ab0a81 | |
parent | e4e699e3280f6aa55bca9f0d0d393e8a92f6bcc4 (diff) |
Set tickTime for server and adjust client session timeout to a legal value
3 files changed, 9 insertions, 4 deletions
diff --git a/configdefinitions/src/vespa/zookeeper-server.def b/configdefinitions/src/vespa/zookeeper-server.def index 006e266916c..b08fc8eeafe 100644 --- a/configdefinitions/src/vespa/zookeeper-server.def +++ b/configdefinitions/src/vespa/zookeeper-server.def @@ -6,8 +6,8 @@ zooKeeperConfigFile string default="conf/zookeeper/zookeeper.cfg" # For more info about the values below, see ZooKeeper documentation -# tick time in milliseconds -tickTime int default=2000 +# tick time in milliseconds, min and max session timeout are 2 and 20 times this value +tickTime int default=6000 initLimit int default=20 syncLimit int default=15 maxClientConnections int default=0 diff --git a/zkfacade/src/main/java/com/yahoo/vespa/curator/Curator.java b/zkfacade/src/main/java/com/yahoo/vespa/curator/Curator.java index 2195a46e274..414a18eb56d 100644 --- a/zkfacade/src/main/java/com/yahoo/vespa/curator/Curator.java +++ b/zkfacade/src/main/java/com/yahoo/vespa/curator/Curator.java @@ -54,7 +54,10 @@ public class Curator implements VespaCurator, AutoCloseable { private static final Logger LOG = Logger.getLogger(Curator.class.getName()); private static final File ZK_CLIENT_CONFIG_FILE = new File(Defaults.getDefaults().underVespaHome("conf/zookeeper/zookeeper-client.cfg")); - private static final Duration ZK_SESSION_TIMEOUT = Duration.ofSeconds(180); + + // Note that session timeout has min and max values are related to tickTime defined by server, see configserver.def + private static final Duration ZK_SESSION_TIMEOUT = Duration.ofSeconds(120); + private static final Duration ZK_CONNECTION_TIMEOUT = Duration.ofSeconds(30); private static final Duration BASE_SLEEP_TIME = Duration.ofSeconds(1); private static final int MAX_RETRIES = 10; diff --git a/zookeeper-server/zookeeper-server-common/src/test/java/com/yahoo/vespa/zookeeper/ConfiguratorTest.java b/zookeeper-server/zookeeper-server-common/src/test/java/com/yahoo/vespa/zookeeper/ConfiguratorTest.java index c40b7cb7b52..ae84ff12b3b 100644 --- a/zookeeper-server/zookeeper-server-common/src/test/java/com/yahoo/vespa/zookeeper/ConfiguratorTest.java +++ b/zookeeper-server/zookeeper-server-common/src/test/java/com/yahoo/vespa/zookeeper/ConfiguratorTest.java @@ -70,6 +70,7 @@ public class ConfiguratorTest { builder.server(newServer(2, "baz", 345, 543, true)); builder.myidFile(idFile.getAbsolutePath()); builder.myid(1); + builder.tickTime(1234); new Configurator(builder.build()).writeConfigToDisk(VespaTlsConfig.tlsDisabled()); validateConfigFileMultipleHosts(cfgFile); validateIdFile(idFile, "1\n"); @@ -127,6 +128,7 @@ public class ConfiguratorTest { builder.myidFile(idFile.getAbsolutePath()); builder.server(newServer(0, "foo", 123, 321, false)); builder.myid(0); + builder.tickTime(1234); return builder; } @@ -146,7 +148,7 @@ public class ConfiguratorTest { } private String commonConfig() { - return "tickTime=2000\n" + + return "tickTime=1234\n" + "initLimit=20\n" + "syncLimit=15\n" + "maxClientCnxns=0\n" + |