From 3358faca20fc1d49c06d7958f00cbed1fc11710a Mon Sep 17 00:00:00 2001 From: David Smiley Date: Mon, 3 Aug 2026 12:58:53 -0400 Subject: [PATCH 1/2] Logging: ZkStateReader.getLeaderRetry to TRACE from DEBUG. But if there's a cache miss, other ZkStateReader watcher registrations will now log at DEBUG. --- .../org/apache/solr/common/cloud/ZkStateReader.java | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/solr/solrj-zookeeper/src/java/org/apache/solr/common/cloud/ZkStateReader.java b/solr/solrj-zookeeper/src/java/org/apache/solr/common/cloud/ZkStateReader.java index 4f0c3bb38366..b9f0c562598e 100644 --- a/solr/solrj-zookeeper/src/java/org/apache/solr/common/cloud/ZkStateReader.java +++ b/solr/solrj-zookeeper/src/java/org/apache/solr/common/cloud/ZkStateReader.java @@ -849,6 +849,7 @@ private void refreshLiveNodes(Watcher watcher) throws KeeperException, Interrupt } public void registerClusterPropertiesListener(ClusterPropertiesListener listener) { + log.debug("registerClusterPropertiesListener"); // fire it once with current properties if (listener.onChange(getClusterProperties())) { removeClusterPropertiesListener(listener); @@ -862,6 +863,7 @@ public void removeClusterPropertiesListener(ClusterPropertiesListener listener) } public void registerLiveNodesListener(LiveNodesListener listener) { + log.debug("registerLiveNodesListener"); // fire it once with current live nodes if (listener.onChange( new TreeSet<>(getClusterState().getLiveNodes()), @@ -1003,7 +1005,7 @@ public Replica getLeaderRetry(String collection, String shard, int timeout) if (c == null) return false; Replica l = getLeader(n, c, shard); if (l != null) { - log.debug("leader found for {}/{} to be {}", collection, shard, l); + log.trace("leader found for {}/{} to be {}", collection, shard, l); leader.set(l); return true; } @@ -1608,6 +1610,7 @@ public void registerCollectionStateWatcher( */ public void registerDocCollectionWatcher( String collection, DocCollectionWatcher docCollectionWatcher) { + log.debug("registerDocCollectionWatcher collection={}", collection); AtomicReference newWatcherRef = new AtomicReference<>(); collectionWatches.compute( collection, @@ -1664,7 +1667,7 @@ public void waitForState( DocCollection docCollection = clusterState.getCollectionOrNull(collection); if (liveNodes != null && docCollection != null) { if (predicate.matches(liveNodes, docCollection)) { - log.debug("Found {} directly in clusterState", predicate); + log.trace("waitForState collection={}: cache hit in clusterState", collection); return; } } @@ -1746,12 +1749,14 @@ public DocCollection waitForState( DocCollection docCollection = clusterState.getCollectionOrNull(collection); if (docCollection != null) { if (predicate.test(docCollection)) { - log.debug("Found {} directly in clusterState", predicate); + log.trace("waitForState collection={}: cache hit in clusterState", collection); return docCollection; } } } + log.debug("waitForState collection={}: not in cached state; add watcher", collection); + final CountDownLatch latch = new CountDownLatch(1); waitLatches.add(latch); AtomicReference docCollectionReference = new AtomicReference<>(); From 7677132fc25e507918cc975f43e4837d14b365b7 Mon Sep 17 00:00:00 2001 From: David Smiley Date: Mon, 3 Aug 2026 14:25:27 -0400 Subject: [PATCH 2/2] remove unintended log --- .../src/java/org/apache/solr/common/cloud/ZkStateReader.java | 2 -- 1 file changed, 2 deletions(-) diff --git a/solr/solrj-zookeeper/src/java/org/apache/solr/common/cloud/ZkStateReader.java b/solr/solrj-zookeeper/src/java/org/apache/solr/common/cloud/ZkStateReader.java index b9f0c562598e..659881033a9e 100644 --- a/solr/solrj-zookeeper/src/java/org/apache/solr/common/cloud/ZkStateReader.java +++ b/solr/solrj-zookeeper/src/java/org/apache/solr/common/cloud/ZkStateReader.java @@ -1755,8 +1755,6 @@ public DocCollection waitForState( } } - log.debug("waitForState collection={}: not in cached state; add watcher", collection); - final CountDownLatch latch = new CountDownLatch(1); waitLatches.add(latch); AtomicReference docCollectionReference = new AtomicReference<>();