You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by ab...@apache.org on 2017/10/31 14:02:24 UTC

[42/50] [abbrv] lucene-solr:jira/solr-11285-sim: SOLR-11576: CollectionsAPIDistributedZkTest.testCollectionsAPI() get failed when query node has stale clusterstate

SOLR-11576: CollectionsAPIDistributedZkTest.testCollectionsAPI() get failed when query node has stale clusterstate


Project: http://git-wip-us.apache.org/repos/asf/lucene-solr/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucene-solr/commit/f6cbce1c
Tree: http://git-wip-us.apache.org/repos/asf/lucene-solr/tree/f6cbce1c
Diff: http://git-wip-us.apache.org/repos/asf/lucene-solr/diff/f6cbce1c

Branch: refs/heads/jira/solr-11285-sim
Commit: f6cbce1c6ec45d02653070bd09b4f48800c010b9
Parents: e0bde57
Author: Cao Manh Dat <da...@apache.org>
Authored: Tue Oct 31 09:13:02 2017 +0700
Committer: Cao Manh Dat <da...@apache.org>
Committed: Tue Oct 31 09:13:02 2017 +0700

----------------------------------------------------------------------
 .../solr/cloud/CollectionsAPIDistributedZkTest.java | 16 +++++++++++++++-
 1 file changed, 15 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/f6cbce1c/solr/core/src/test/org/apache/solr/cloud/CollectionsAPIDistributedZkTest.java
----------------------------------------------------------------------
diff --git a/solr/core/src/test/org/apache/solr/cloud/CollectionsAPIDistributedZkTest.java b/solr/core/src/test/org/apache/solr/cloud/CollectionsAPIDistributedZkTest.java
index b2f0d44..b385b4f 100644
--- a/solr/core/src/test/org/apache/solr/cloud/CollectionsAPIDistributedZkTest.java
+++ b/solr/core/src/test/org/apache/solr/cloud/CollectionsAPIDistributedZkTest.java
@@ -457,7 +457,21 @@ public class CollectionsAPIDistributedZkTest extends SolrCloudTestCase {
         .add("id", "7")
         .add("id", "8")
         .commit(cluster.getSolrClient(), collectionName);
-    assertEquals(3, cluster.getSolrClient().query(collectionName, new SolrQuery("*:*")).getResults().getNumFound());
+    TimeOut timeOut = new TimeOut(10, TimeUnit.SECONDS);
+    while (!timeOut.hasTimedOut()) {
+      try {
+        long numFound = cluster.getSolrClient().query(collectionName, new SolrQuery("*:*")).getResults().getNumFound();
+        assertEquals(3, numFound);
+        break;
+      } catch (Exception e) {
+        // Query node can have stale clusterstate
+        log.info("Error when query " + collectionName, e);
+        Thread.sleep(500);
+      }
+    }
+    if (timeOut.hasTimedOut()) {
+      fail("Timeout on query " + collectionName);
+    }
 
     checkNoTwoShardsUseTheSameIndexDir();
   }