You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by sh...@apache.org on 2015/05/27 14:49:21 UTC

svn commit: r1682003 - in /lucene/dev/branches/branch_5x: ./ solr/ solr/CHANGES.txt solr/test-framework/ solr/test-framework/src/java/org/apache/solr/cloud/MiniSolrCloudCluster.java

Author: shalin
Date: Wed May 27 12:49:21 2015
New Revision: 1682003

URL: http://svn.apache.org/r1682003
Log:
SOLR-7146: MiniSolrCloudCluster based tests can fail with ZooKeeperException NoNode for /live_nodes

Modified:
    lucene/dev/branches/branch_5x/   (props changed)
    lucene/dev/branches/branch_5x/solr/   (props changed)
    lucene/dev/branches/branch_5x/solr/CHANGES.txt   (contents, props changed)
    lucene/dev/branches/branch_5x/solr/test-framework/   (props changed)
    lucene/dev/branches/branch_5x/solr/test-framework/src/java/org/apache/solr/cloud/MiniSolrCloudCluster.java

Modified: lucene/dev/branches/branch_5x/solr/CHANGES.txt
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_5x/solr/CHANGES.txt?rev=1682003&r1=1682002&r2=1682003&view=diff
==============================================================================
--- lucene/dev/branches/branch_5x/solr/CHANGES.txt (original)
+++ lucene/dev/branches/branch_5x/solr/CHANGES.txt Wed May 27 12:49:21 2015
@@ -42,6 +42,9 @@ Other Changes
 
 * SOLR-7595: Allow method chaining for all CollectionAdminRequests in Solrj. (shalin)
 
+* SOLR-7146: MiniSolrCloudCluster based tests can fail with ZooKeeperException NoNode for /live_nodes.
+  (Vamsee Yarlagadda via shalin)
+
 ==================  5.2.0 ==================
 
 Consult the LUCENE_CHANGES.txt file for additional, low level, changes in this release

Modified: lucene/dev/branches/branch_5x/solr/test-framework/src/java/org/apache/solr/cloud/MiniSolrCloudCluster.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_5x/solr/test-framework/src/java/org/apache/solr/cloud/MiniSolrCloudCluster.java?rev=1682003&r1=1682002&r2=1682003&view=diff
==============================================================================
--- lucene/dev/branches/branch_5x/solr/test-framework/src/java/org/apache/solr/cloud/MiniSolrCloudCluster.java (original)
+++ lucene/dev/branches/branch_5x/solr/test-framework/src/java/org/apache/solr/cloud/MiniSolrCloudCluster.java Wed May 27 12:49:21 2015
@@ -167,6 +167,29 @@ public class MiniSolrCloudCluster {
       throw startupError;
     }
 
+    try (SolrZkClient zkClient = new SolrZkClient(zkServer.getZkHost(),
+        AbstractZkTestCase.TIMEOUT, 45000, null)) {
+      int numliveNodes = 0;
+      int retries = 60;
+      String liveNodesPath = "/solr/live_nodes";
+      // Wait up to 60 seconds for number of live_nodes to match up number of servers
+      do {
+        if (zkClient.exists(liveNodesPath, true)) {
+          numliveNodes = zkClient.getChildren(liveNodesPath, null, true).size();
+          if (numliveNodes == numServers) {
+            break;
+          }
+        }
+        retries--;
+        if (retries == 0) {
+          throw new IllegalStateException("Solr servers failed to register with ZK."
+              + " Current count: " + numliveNodes + "; Expected count: " + numServers);
+        }
+
+        Thread.sleep(1000);
+      } while (numliveNodes != numServers);
+    }
+
     solrClient = buildSolrClient();
   }