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

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

Repository: lucene-solr
Updated Branches:
  refs/heads/branch_7x 003b94b6e -> a4ef53e6e


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/a4ef53e6
Tree: http://git-wip-us.apache.org/repos/asf/lucene-solr/tree/a4ef53e6
Diff: http://git-wip-us.apache.org/repos/asf/lucene-solr/diff/a4ef53e6

Branch: refs/heads/branch_7x
Commit: a4ef53e6ed748549c8aa2ae8395d2bce12c6eb4d
Parents: 003b94b
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:35 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/a4ef53e6/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();
   }