From 491c3ff05730d5ab2351eb292bfcfc2b126b7514 Mon Sep 17 00:00:00 2001 From: Harald Musum Date: Fri, 10 Mar 2023 09:17:25 +0100 Subject: Log zookeeper start message only on retries --- .../main/java/com/yahoo/vespa/zookeeper/ZooKeeperRunner.java | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'zookeeper-server/zookeeper-server-common/src/main/java') diff --git a/zookeeper-server/zookeeper-server-common/src/main/java/com/yahoo/vespa/zookeeper/ZooKeeperRunner.java b/zookeeper-server/zookeeper-server-common/src/main/java/com/yahoo/vespa/zookeeper/ZooKeeperRunner.java index b30607299ad..9ada45204e8 100644 --- a/zookeeper-server/zookeeper-server-common/src/main/java/com/yahoo/vespa/zookeeper/ZooKeeperRunner.java +++ b/zookeeper-server/zookeeper-server-common/src/main/java/com/yahoo/vespa/zookeeper/ZooKeeperRunner.java @@ -68,10 +68,7 @@ public class ZooKeeperRunner implements Runnable { Instant end = now.plus(START_TIMEOUT); for (int attempt = 1; now.isBefore(end) && !executorService.isShutdown(); attempt++) { try { - log.log(Level.INFO, "Starting ZooKeeper server with " + path.toFile().getAbsolutePath() + - ". Trying to establish ZooKeeper quorum (members: " + - zookeeperServerHostnames(zookeeperServerConfig) + ", attempt " + attempt + ")"); - startServer(path); // Will block in a real implementation of VespaZooKeeperServer + startServer(path, attempt); // Will block in a real implementation of VespaZooKeeperServer return; } catch (RuntimeException e) { String messagePart = "Starting " + serverDescription() + " failed on attempt " + attempt; @@ -96,7 +93,12 @@ public class ZooKeeperRunner implements Runnable { return (server.reconfigurable() ? "" : "non-") + "reconfigurable ZooKeeper server"; } - private void startServer(Path path) { + private void startServer(Path path, int attempt) { + if (attempt > 1) + log.log(Level.INFO, "Starting ZooKeeper server with " + path.toFile().getAbsolutePath() + + ". Trying to establish ZooKeeper quorum (members: " + + zookeeperServerHostnames(zookeeperServerConfig) + ", attempt " + attempt + ")"); + // Note: Hack to make this work in ZooKeeper 3.6, where metrics provider class is // loaded by using Thread.currentThread().getContextClassLoader() which does not work // well in the container -- cgit v1.2.3