You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by no...@apache.org on 2016/02/24 07:12:22 UTC

[15/53] [abbrv] lucene-solr git commit: SOLR-8693: Improve ZkStateReader logging.

SOLR-8693: Improve ZkStateReader logging.


Project: http://git-wip-us.apache.org/repos/asf/lucene-solr/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucene-solr/commit/3124a4de
Tree: http://git-wip-us.apache.org/repos/asf/lucene-solr/tree/3124a4de
Diff: http://git-wip-us.apache.org/repos/asf/lucene-solr/diff/3124a4de

Branch: refs/heads/apiv2
Commit: 3124a4debdeae794cd64b4d0e8b78d23aad73c5e
Parents: 0f29b3e
Author: markrmiller <ma...@apache.org>
Authored: Fri Feb 19 19:08:11 2016 -0500
Committer: markrmiller <ma...@apache.org>
Committed: Fri Feb 19 19:09:58 2016 -0500

----------------------------------------------------------------------
 solr/CHANGES.txt                                |  2 ++
 .../apache/solr/common/cloud/ZkStateReader.java | 28 +++++++++++++++-----
 2 files changed, 24 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/3124a4de/solr/CHANGES.txt
----------------------------------------------------------------------
diff --git a/solr/CHANGES.txt b/solr/CHANGES.txt
index 42c57c1..a57f8e5 100644
--- a/solr/CHANGES.txt
+++ b/solr/CHANGES.txt
@@ -286,6 +286,8 @@ Other Changes
 * SOLR-8677: Prevent shards containing invalid characters from being created.  Checks added server-side
   and in SolrJ.  (Shai Erera, Jason Gerlowski, Anshum Gupta)
 
+* SOLR-8693: Improve ZkStateReader logging. (Scott Blum via Mark Miller)
+
 ======================= 5.5.0 =======================
 
 Consult the LUCENE_CHANGES.txt file for additional, low level, changes in this release

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/3124a4de/solr/solrj/src/java/org/apache/solr/common/cloud/ZkStateReader.java
----------------------------------------------------------------------
diff --git a/solr/solrj/src/java/org/apache/solr/common/cloud/ZkStateReader.java b/solr/solrj/src/java/org/apache/solr/common/cloud/ZkStateReader.java
index 910b47e..a904f3e 100644
--- a/solr/solrj/src/java/org/apache/solr/common/cloud/ZkStateReader.java
+++ b/solr/solrj/src/java/org/apache/solr/common/cloud/ZkStateReader.java
@@ -29,6 +29,7 @@ import java.util.List;
 import java.util.Map;
 import java.util.Map.Entry;
 import java.util.Set;
+import java.util.TreeSet;
 import java.util.concurrent.ConcurrentHashMap;
 import java.util.concurrent.TimeUnit;
 
@@ -420,11 +421,21 @@ public class ZkStateReader implements Closeable {
     this.clusterState = new ClusterState(liveNodes, result, legacyClusterStateVersion);
     LOG.debug("clusterStateSet: version [{}] legacy [{}] interesting [{}] watched [{}] lazy [{}] total [{}]",
         clusterState.getZkClusterStateVersion(),
-        legacyCollectionStates.keySet(),
-        interestingCollections,
-        watchedCollectionStates.keySet(),
-        lazyCollectionStates.keySet(),
-        clusterState.getCollections());
+        legacyCollectionStates.keySet().size(),
+        interestingCollections.size(),
+        watchedCollectionStates.keySet().size(),
+        lazyCollectionStates.keySet().size(),
+        clusterState.getCollectionStates().size());
+
+    if (LOG.isTraceEnabled()) {
+      LOG.trace("clusterStateSet: version [{}] legacy [{}] interesting [{}] watched [{}] lazy [{}] total [{}]",
+          clusterState.getZkClusterStateVersion(),
+          legacyCollectionStates.keySet(),
+          interestingCollections,
+          watchedCollectionStates.keySet(),
+          lazyCollectionStates.keySet(),
+          clusterState.getCollectionStates());
+    }
   }
 
   /**
@@ -533,17 +544,22 @@ public class ZkStateReader implements Closeable {
     Set<String> newLiveNodes;
     try {
       List<String> nodeList = zkClient.getChildren(LIVE_NODES_ZKNODE, watcher, true);
-      LOG.debug("Updating live nodes from ZooKeeper... [{}]", nodeList.size());
       newLiveNodes = new HashSet<>(nodeList);
     } catch (KeeperException.NoNodeException e) {
       newLiveNodes = emptySet();
     }
+    Set<String> oldLiveNodes;
     synchronized (getUpdateLock()) {
+      oldLiveNodes = this.liveNodes;
       this.liveNodes = newLiveNodes;
       if (clusterState != null) {
         clusterState.setLiveNodes(newLiveNodes);
       }
     }
+    LOG.info("Updated live nodes from ZooKeeper... ({}) -> ({})", oldLiveNodes.size(), newLiveNodes.size());
+    if (LOG.isDebugEnabled()) {
+      LOG.debug("Updated live nodes from ZooKeeper... {} -> {}", new TreeSet<>(oldLiveNodes), new TreeSet<>(newLiveNodes));
+    }
   }
 
   /**