You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by cp...@apache.org on 2015/12/07 15:08:10 UTC

svn commit: r1718364 - in /lucene/dev/trunk/solr: CHANGES.txt core/src/test/org/apache/solr/cloud/BasicDistributedZkTest.java

Author: cpoerschke
Date: Mon Dec  7 14:08:10 2015
New Revision: 1718364

URL: http://svn.apache.org/viewvc?rev=1718364&view=rev
Log:
SOLR-7774: revise BasicDistributedZkTest.test logic w.r.t. 'commitWithin did not work on some nodes'

Modified:
    lucene/dev/trunk/solr/CHANGES.txt
    lucene/dev/trunk/solr/core/src/test/org/apache/solr/cloud/BasicDistributedZkTest.java

Modified: lucene/dev/trunk/solr/CHANGES.txt
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/CHANGES.txt?rev=1718364&r1=1718363&r2=1718364&view=diff
==============================================================================
--- lucene/dev/trunk/solr/CHANGES.txt (original)
+++ lucene/dev/trunk/solr/CHANGES.txt Mon Dec  7 14:08:10 2015
@@ -252,6 +252,9 @@ Other Changes
 * SOLR-8381: Cleanup data_driven managed-schema and solrconfig.xml files. Commented out copyFields are removed
   and solrconfig.xml doesn't refer to field which are not defined. (Varun Thacker)
 
+* SOLR-7774: revise BasicDistributedZkTest.test logic w.r.t. 'commitWithin did not work on some nodes'
+  (Christine Poerschke)
+
 ==================  5.4.0 ==================
 
 Consult the LUCENE_CHANGES.txt file for additional, low level, changes in this release

Modified: lucene/dev/trunk/solr/core/src/test/org/apache/solr/cloud/BasicDistributedZkTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/core/src/test/org/apache/solr/cloud/BasicDistributedZkTest.java?rev=1718364&r1=1718363&r2=1718364&view=diff
==============================================================================
--- lucene/dev/trunk/solr/core/src/test/org/apache/solr/cloud/BasicDistributedZkTest.java (original)
+++ lucene/dev/trunk/solr/core/src/test/org/apache/solr/cloud/BasicDistributedZkTest.java Mon Dec  7 14:08:10 2015
@@ -64,6 +64,7 @@ import java.util.ArrayList;
 import java.util.Collections;
 import java.util.HashMap;
 import java.util.HashSet;
+import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
 import java.util.Set;
@@ -322,21 +323,28 @@ public class BasicDistributedZkTest exte
 
     // try commitWithin
     long before = cloudClient.query(new SolrQuery("*:*")).getResults().getNumFound();
+    for (SolrClient client : clients) {
+      assertEquals("unexpected pre-commitWithin document count on node: " + ((HttpSolrClient)client).getBaseURL(), before, client.query(new SolrQuery("*:*")).getResults().getNumFound());
+    }
+
     ModifiableSolrParams params = new ModifiableSolrParams();
     params.set("commitWithin", 10);
     add(cloudClient, params, getDoc("id", 300));
 
+    final List<SolrClient> clientsToCheck = new ArrayList<>(clients);
     TimeOut timeout = new TimeOut(45, TimeUnit.SECONDS);
-    while (cloudClient.query(new SolrQuery("*:*")).getResults().getNumFound() != before + 1) {
-      if (timeout.hasTimedOut()) {
-        fail("commitWithin did not work");
+    do {
+      final Iterator<SolrClient> it = clientsToCheck.iterator();
+      while (it.hasNext()) {
+        final SolrClient sc = it.next();
+        if ((before + 1) == sc.query(new SolrQuery("*:*")).getResults().getNumFound()) {
+          it.remove();
+        }
       }
       Thread.sleep(100);
-    }
+    } while (!clientsToCheck.isEmpty() && !timeout.hasTimedOut());
     
-    for (SolrClient client : clients) {
-      assertEquals("commitWithin did not work on node: " + ((HttpSolrClient)client).getBaseURL(), before + 1, client.query(new SolrQuery("*:*")).getResults().getNumFound());
-    }
+    assertTrue("commitWithin did not work on some nodes: "+clientsToCheck, clientsToCheck.isEmpty());
     
     // TODO: This test currently fails because debug info is obtained only
     // on shards with matches.