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

This commit is contained in:
Cao Manh Dat 2017-10-31 09:13:02 +07:00
parent e0bde57981
commit f6cbce1c6e
1 changed files with 15 additions and 1 deletions

View File

@ -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();
}