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