You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@lucene.apache.org by GitBox <gi...@apache.org> on 2020/06/10 20:57:00 UTC

[GitHub] [lucene-solr] murblanc opened a new pull request #1565: SOLR-12823: fix test failures

murblanc opened a new pull request #1565:
URL: https://github.com/apache/lucene-solr/pull/1565


   # Description
   
   Fix test failures in CloudHttp2SolrClientTest CloudSolrClientTest TestCloudSolrClientConnections due to previous SOLR-12823 commit.
   
   # Solution
   
   ZkStateReader returns a specific SolrException when expected nodes in the cluster created during cluster initialization do not exist.
   
   # Tests
   
   Fixes the tests mentioned above.
   
   # Checklist
   
   Please review the following and check all that apply:
   
   - [X] I have reviewed the guidelines for [How to Contribute](https://wiki.apache.org/solr/HowToContribute) and my code conforms to the standards described there to the best of my ability.
   - [X] I have created a Jira issue and added the issue ID to my pull request title.
   - [X] I have given Solr maintainers [access](https://help.github.com/en/articles/allowing-changes-to-a-pull-request-branch-created-from-a-fork) to contribute to my PR branch. (optional but recommended)
   - [X] I have developed this patch against the `master` branch.
   - [X] I have run `ant precommit` and the appropriate test suite.
   - [ ] I have added tests for my changes.
   - [ ] I have added documentation for the [Ref Guide](https://github.com/apache/lucene-solr/tree/master/solr/solr-ref-guide) (for Solr changes only).
   


----------------------------------------------------------------
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@lucene.apache.org
For additional commands, e-mail: issues-help@lucene.apache.org


[GitHub] [lucene-solr] murblanc commented on a change in pull request #1565: SOLR-12823: fix test failures

Posted by GitBox <gi...@apache.org>.
murblanc commented on a change in pull request #1565:
URL: https://github.com/apache/lucene-solr/pull/1565#discussion_r438409534



##########
File path: solr/solrj/src/java/org/apache/solr/common/cloud/ZkStateReader.java
##########
@@ -476,27 +476,32 @@ public synchronized void createClusterStateWatchersAndUpdate() throws KeeperExce
 
     log.debug("Updating cluster state from ZooKeeper... ");
 
-    // on reconnect of SolrZkClient force refresh and re-add watches.
-    loadClusterProperties();
-    refreshLiveNodes(new LiveNodeWatcher());
-    refreshCollections();
-    refreshCollectionList(new CollectionsChildWatcher());
-    refreshAliases(aliasesManager);
-
-    if (securityNodeListener != null) {
-      addSecurityNodeWatcher(pair -> {
-        ConfigData cd = new ConfigData();
-        cd.data = pair.first() == null || pair.first().length == 0 ? EMPTY_MAP : Utils.getDeepCopy((Map) fromJSON(pair.first()), 4, false);
-        cd.version = pair.second() == null ? -1 : pair.second().getVersion();
-        securityData = cd;
-        securityNodeListener.run();
+    try {
+      // on reconnect of SolrZkClient force refresh and re-add watches.
+      loadClusterProperties();
+      refreshLiveNodes(new LiveNodeWatcher());
+      refreshCollections();
+      refreshCollectionList(new CollectionsChildWatcher());
+      refreshAliases(aliasesManager);
+
+      if (securityNodeListener != null) {
+        addSecurityNodeWatcher(pair -> {
+          ConfigData cd = new ConfigData();
+          cd.data = pair.first() == null || pair.first().length == 0 ? EMPTY_MAP : Utils.getDeepCopy((Map) fromJSON(pair.first()), 4, false);
+          cd.version = pair.second() == null ? -1 : pair.second().getVersion();
+          securityData = cd;
+          securityNodeListener.run();
+        });
+        securityData = getSecurityProps(true);
+      }
+
+      collectionPropsObservers.forEach((k, v) -> {
+        collectionPropsWatchers.computeIfAbsent(k, PropsWatcher::new).refreshAndWatch(true);
       });
-      securityData = getSecurityProps(true);
+    } catch (KeeperException.NoNodeException nne) {
+      throw new SolrException(ErrorCode.SERVICE_UNAVAILABLE,
+          "Cannot connect to cluster at " + zkClient.getZkServerAddress() + ": cluster not found/not ready");

Review comment:
       Could have instead picked another path other than `CLUSTER_STATE` from those created in `ZkController.createClusterZkNodes()` and explicitly tested it like was done before, but this seemed cleaner.
   Open to change.




----------------------------------------------------------------
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@lucene.apache.org
For additional commands, e-mail: issues-help@lucene.apache.org


[GitHub] [lucene-solr] madrob merged pull request #1565: SOLR-12823: fix test failures

Posted by GitBox <gi...@apache.org>.
madrob merged pull request #1565:
URL: https://github.com/apache/lucene-solr/pull/1565


   


----------------------------------------------------------------
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@lucene.apache.org
For additional commands, e-mail: issues-help@lucene.apache.org