diff --git a/solr/CHANGES.txt b/solr/CHANGES.txt index 2200d067ca5..9666795a4f3 100644 --- a/solr/CHANGES.txt +++ b/solr/CHANGES.txt @@ -169,6 +169,9 @@ Other Changes * SOLR-9163: Sync up basic_configs and data_driven_schema_configs, removing almost all differences except what is required for schemaless. (yonik) +* SOLR-9340: Change ZooKeeper disconnect and session expiry related logging from INFO to WARN to + make debugging easier (Varun Thacker) + ================== 6.1.0 ================== Consult the LUCENE_CHANGES.txt file for additional, low level, changes in this release. diff --git a/solr/solrj/src/java/org/apache/solr/common/cloud/ConnectionManager.java b/solr/solrj/src/java/org/apache/solr/common/cloud/ConnectionManager.java index 1754a2d93ec..c944dec2f89 100644 --- a/solr/solrj/src/java/org/apache/solr/common/cloud/ConnectionManager.java +++ b/solr/solrj/src/java/org/apache/solr/common/cloud/ConnectionManager.java @@ -28,6 +28,10 @@ import org.apache.zookeeper.Watcher.Event.KeeperState; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import static org.apache.zookeeper.Watcher.Event.KeeperState.AuthFailed; +import static org.apache.zookeeper.Watcher.Event.KeeperState.Disconnected; +import static org.apache.zookeeper.Watcher.Event.KeeperState.Expired; + public class ConnectionManager implements Watcher { private static final Logger log = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass()); @@ -100,7 +104,10 @@ public class ConnectionManager implements Watcher { @Override public void process(WatchedEvent event) { - if (log.isInfoEnabled()) { + if (event.getState() == AuthFailed || event.getState() == Disconnected || event.getState() == Expired) { + log.warn("Watcher " + this + " name:" + name + " got event " + event + + " path:" + event.getPath() + " type:" + event.getType()); + } else if (log.isInfoEnabled()) { log.info("Watcher " + this + " name:" + name + " got event " + event + " path:" + event.getPath() + " type:" + event.getType()); } @@ -115,12 +122,12 @@ public class ConnectionManager implements Watcher { if (state == KeeperState.SyncConnected) { connected(); connectionStrategy.connected(); - } else if (state == KeeperState.Expired) { + } else if (state == Expired) { // we don't call disconnected here, because we know we are expired connected = false; likelyExpiredState = LikelyExpiredState.EXPIRED; - log.info("Our previous ZooKeeper session was expired. Attempting to reconnect to recover relationship with ZooKeeper..."); + log.warn("Our previous ZooKeeper session was expired. Attempting to reconnect to recover relationship with ZooKeeper..."); if (beforeReconnect != null) { try { @@ -176,7 +183,7 @@ public class ConnectionManager implements Watcher { } while (!isClosed); log.info("Connected:" + connected); } else if (state == KeeperState.Disconnected) { - log.info("zkClient has disconnected"); + log.warn("zkClient has disconnected"); disconnected(); connectionStrategy.disconnected(); } else if (state == KeeperState.AuthFailed) { diff --git a/solr/solrj/src/java/org/apache/solr/common/cloud/DefaultConnectionStrategy.java b/solr/solrj/src/java/org/apache/solr/common/cloud/DefaultConnectionStrategy.java index cbec324b880..e16ca68bb0e 100644 --- a/solr/solrj/src/java/org/apache/solr/common/cloud/DefaultConnectionStrategy.java +++ b/solr/solrj/src/java/org/apache/solr/common/cloud/DefaultConnectionStrategy.java @@ -49,7 +49,7 @@ public class DefaultConnectionStrategy extends ZkClientConnectionStrategy { @Override public void reconnect(final String serverAddress, final int zkClientTimeout, final Watcher watcher, final ZkUpdate updater) throws IOException { - log.info("Connection expired - starting a new one..."); + log.warn("Connection expired - starting a new one..."); SolrZooKeeper zk = createSolrZooKeeper(serverAddress, zkClientTimeout, watcher); boolean success = false; try { @@ -59,7 +59,7 @@ public class DefaultConnectionStrategy extends ZkClientConnectionStrategy { log.info("Reconnected to ZooKeeper"); } catch (Exception e) { SolrException.log(log, "Reconnect to ZooKeeper failed", e); - log.info("Reconnect to ZooKeeper failed"); + log.warn("Reconnect to ZooKeeper failed"); } finally { if (!success) { try {