SOLR-7840: ZkStateReader.updateClusterState fetches watched collections twice from ZK

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1693251 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Shalin Shekhar Mangar 2015-07-29 12:44:07 +00:00
parent a5d3bd5645
commit c8bdf9bf19
2 changed files with 4 additions and 14 deletions

View File

@ -273,6 +273,7 @@ Optimizations
saw a 7x improvement when field1 and 1M unique terms and field2 had 1000 unique terms.
(yonik)
* SOLR-7840: ZkStateReader.updateClusterState fetches watched collections twice from ZK. (shalin)
Other Changes
----------------------

View File

@ -428,7 +428,7 @@ public class ZkStateReader implements Closeable {
if (watchedCollections.contains(s)) {
DocCollection live = getCollectionLive(this, s);
if (live != null) {
watchedCollectionStates.put(s, live);
updateWatchedCollection(live);
// if it is a watched collection, add too
result.put(s, new ClusterState.CollectionRef(live));
}
@ -506,15 +506,6 @@ public class ZkStateReader implements Closeable {
}
this.clusterState = clusterState;
}
synchronized (ZkStateReader.this) {
for (String watchedCollection : watchedCollections) {
DocCollection live = getCollectionLive(this, watchedCollection);
if (live != null) {
updateWatchedCollection(live);
}
}
}
} else {
if (clusterStateUpdateScheduled) {
log.debug("Cloud state update for ZooKeeper already scheduled");
@ -946,9 +937,7 @@ public class ZkStateReader implements Closeable {
private void updateWatchedCollection(DocCollection newState) {
watchedCollectionStates.put(newState.getName(), newState);
log.info("Updating data for {} to ver {} ", newState.getName(),
newState.getZNodeVersion());
log.info("Updating data for {} to ver {} ", newState.getName(), newState.getZNodeVersion());
this.clusterState = clusterState.copyWith(newState.getName(), newState);
}