dsmiley commented on code in PR #5314:
URL: https://github.com/apache/solr/pull/5314#discussion_r4577181223
##########
solr/solrj-zookeeper/src/java/org/apache/solr/client/solrj/impl/ZkClientClusterStateProvider.java:
##########
@@ -80,12 +80,39 @@ public ZkClientClusterStateProvider(String zkHost) {
@Override
public ClusterState.CollectionRef getState(String collection) {
- ClusterState clusterState = getZkStateReader().getClusterState();
- if (clusterState != null) {
- return clusterState.getCollectionRef(collection);
- } else {
+ ZkStateReader reader = getZkStateReader();
+ ClusterState clusterState = reader.getClusterState();
+ if (clusterState == null) {
return null;
}
+ ClusterState.CollectionRef ref = clusterState.getCollectionRef(collection);
+ // Alias names are probed as collections before they are resolved. Avoid a
ZooKeeper
+ // lookup for a known alias on every request.
+ if (ref != null || reader.getAliases().hasAlias(collection)) {
+ return ref;
+ }
+
+ try {
+ // Curator sync is asynchronous; wait for it before reading a missing
collection.
+ reader.getZkClient().sync(ZkStateReader.COLLECTIONS_ZKNODE);
Review Comment:
good enough!
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]