mirror of https://github.com/apache/lucene.git
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:
parent
a42ecace8b
commit
b422645bde
|
@ -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());
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue