SOLR-6591: ZkStateReader.updateClusterState should refresh cluster state for watched collections

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1634554 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Shalin Shekhar Mangar 2014-10-27 14:51:08 +00:00
parent a42ecace8b
commit b422645bde
1 changed files with 19 additions and 14 deletions

View File

@ -448,13 +448,17 @@ public class ZkStateReader implements Closeable {
// collections in
// clusterstate.json
for (String s : getIndividualColls()) {
DocCollection watched = watchedCollectionStates.get(s);
if (watched != null) {
synchronized (this) {
if (watchedCollections.contains(s)) {
DocCollection live = getCollectionLive(this, s);
watchedCollectionStates.put(s, live);
// if it is a watched collection, add too
result.put(s, new ClusterState.CollectionRef(watched));
result.put(s, new ClusterState.CollectionRef(live));
} else {
// if it is not collection, then just create a reference which can fetch
// the collection object just in time from ZK
// this is also cheap (lazy loaded) so we put it inside the synchronized
// block although it is not required
final String collName = s;
result.put(s, new ClusterState.CollectionRef(null) {
@Override
@ -464,6 +468,7 @@ public class ZkStateReader implements Closeable {
});
}
}
}
return new ClusterState(ln, result, stat.getVersion());
}