lucene-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From markrmil...@apache.org
Subject svn commit: r1579542 - in /lucene/dev/branches/branch_4x: ./ solr/ solr/core/ solr/core/src/test/org/apache/solr/cloud/ solr/test-framework/ solr/test-framework/src/java/org/apache/solr/cloud/
Date Thu, 20 Mar 2014 05:17:48 GMT
Author: markrmiller
Date: Thu Mar 20 05:17:48 2014
New Revision: 1579542

URL: http://svn.apache.org/r1579542
Log:
SOLR-5888:  Speed up SyncSliceTest as well as some other tests.

Modified:
    lucene/dev/branches/branch_4x/   (props changed)
    lucene/dev/branches/branch_4x/solr/   (props changed)
    lucene/dev/branches/branch_4x/solr/core/   (props changed)
    lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/cloud/ChaosMonkeyNothingIsSafeTest.java
    lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/cloud/SyncSliceTest.java
    lucene/dev/branches/branch_4x/solr/test-framework/   (props changed)
    lucene/dev/branches/branch_4x/solr/test-framework/src/java/org/apache/solr/cloud/AbstractFullDistribZkTestBase.java

Modified: lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/cloud/ChaosMonkeyNothingIsSafeTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/cloud/ChaosMonkeyNothingIsSafeTest.java?rev=1579542&r1=1579541&r2=1579542&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/cloud/ChaosMonkeyNothingIsSafeTest.java
(original)
+++ lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/cloud/ChaosMonkeyNothingIsSafeTest.java
Thu Mar 20 05:17:48 2014
@@ -313,7 +313,7 @@ public class ChaosMonkeyNothingIsSafeTes
         
         try {
           numAdds++;
-          if (numAdds > 4000)
+          if (numAdds > (TEST_NIGHTLY ? 4002 : 197))
             continue;
           SolrInputDocument doc = getDoc(
               "id",

Modified: lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/cloud/SyncSliceTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/cloud/SyncSliceTest.java?rev=1579542&r1=1579541&r2=1579542&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/cloud/SyncSliceTest.java
(original)
+++ lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/cloud/SyncSliceTest.java
Thu Mar 20 05:17:48 2014
@@ -164,10 +164,10 @@ public class SyncSliceTest extends Abstr
     assertEquals(shardCount - 1, jetties.size());
     
     chaosMonkey.killJetty(leaderJetty);
-
-    Thread.sleep(2000);
     
-    waitForThingsToLevelOut(120);
+    Thread.sleep(3000);
+    
+    waitForNoShardInconsistency();
     
     Thread.sleep(1000);
     
@@ -187,7 +187,7 @@ public class SyncSliceTest extends Abstr
     // bring back dead node
     ChaosMonkey.start(deadJetty.jetty); // he is not the leader anymore
     
-    waitTillRecovered();
+    waitTillAllNodesActive();
     
     skipServers = getRandomOtherJetty(leaderJetty, deadJetty);
     skipServers.addAll( getRandomOtherJetty(leaderJetty, deadJetty));
@@ -228,20 +228,14 @@ public class SyncSliceTest extends Abstr
     // kill the current leader
     chaosMonkey.killJetty(leaderJetty);
     
-    Thread.sleep(3000);
-    
-    waitForThingsToLevelOut(120);
-    
-    Thread.sleep(2000);
-    
-    waitForRecoveriesToFinish(false);
+    waitForNoShardInconsistency();
 
     checkShardConsistency(true, true);
     
     success = true;
   }
 
-  private void waitTillRecovered() throws Exception {
+  private void waitTillAllNodesActive() throws Exception {
     for (int i = 0; i < 60; i++) { 
       Thread.sleep(3000);
       ZkStateReader zkStateReader = cloudClient.getZkStateReader();
@@ -264,7 +258,7 @@ public class SyncSliceTest extends Abstr
       }
     }
     printLayout();
-    fail("timeout waiting to see recovered node");
+    fail("timeout waiting to see all nodes active");
   }
 
   private String waitTillInconsistent() throws Exception, InterruptedException {

Modified: lucene/dev/branches/branch_4x/solr/test-framework/src/java/org/apache/solr/cloud/AbstractFullDistribZkTestBase.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/solr/test-framework/src/java/org/apache/solr/cloud/AbstractFullDistribZkTestBase.java?rev=1579542&r1=1579541&r2=1579542&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/solr/test-framework/src/java/org/apache/solr/cloud/AbstractFullDistribZkTestBase.java
(original)
+++ lucene/dev/branches/branch_4x/solr/test-framework/src/java/org/apache/solr/cloud/AbstractFullDistribZkTestBase.java
Thu Mar 20 05:17:48 2014
@@ -1510,7 +1510,43 @@ public abstract class AbstractFullDistri
       }
       
       if (failMessage != null) {
-        retry  = true;
+        log.info("shard inconsistency - waiting ...");
+        retry = true;
+      } else {
+        retry = false;
+      }
+      cnt++;
+      if (cnt > 20) break;
+      Thread.sleep(2000);
+    } while (retry);
+  }
+  
+  
+  public void waitForNoShardInconsistency() throws Exception {
+    log.info("Wait for no shard inconsistency");
+    int cnt = 0;
+    boolean retry = false;
+    do {
+      try {
+        commit();
+      } catch (Throwable t) {
+        t.printStackTrace();
+        // we don't care if this commit fails on some nodes
+      }
+      
+      updateMappingsFromZk(jettys, clients);
+      
+      Set<String> theShards = shardToJetty.keySet();
+      String failMessage = null;
+      for (String shard : theShards) {
+        failMessage = checkShardConsistency(shard, true, false);
+      }
+      
+      if (failMessage != null) {
+        log.info("shard inconsistency - waiting ...");
+        retry = true;
+      } else {
+        retry = false;
       }
       cnt++;
       if (cnt > 20) break;



Mime
View raw message