SOLR-8693: Improve ZkStateReader logging.

This commit is contained in:
markrmiller 2016-02-19 19:08:11 -05:00
parent 0f29b3ec7f
commit 3124a4debd
2 changed files with 24 additions and 6 deletions

View File

@ -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

View File

@ -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;
@ -419,12 +420,22 @@ 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().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.getCollections());
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));
}
}
/**