You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by ma...@apache.org on 2013/11/25 22:14:11 UTC

svn commit: r1545409 - in /lucene/dev/trunk/solr: core/src/test/org/apache/solr/cloud/ChaosMonkeyNothingIsSafeTest.java core/src/test/org/apache/solr/cloud/ChaosMonkeySafeLeaderTest.java test-framework/src/java/org/apache/solr/cloud/ChaosMonkey.java

Author: markrmiller
Date: Mon Nov 25 21:14:11 2013
New Revision: 1545409

URL: http://svn.apache.org/r1545409
Log:
tests: have ChaosMonkeyNothingIsSafeTest start up down nodes at the end so that any final updates won't fail because there is no leader coming

Modified:
    lucene/dev/trunk/solr/core/src/test/org/apache/solr/cloud/ChaosMonkeyNothingIsSafeTest.java
    lucene/dev/trunk/solr/core/src/test/org/apache/solr/cloud/ChaosMonkeySafeLeaderTest.java
    lucene/dev/trunk/solr/test-framework/src/java/org/apache/solr/cloud/ChaosMonkey.java

Modified: lucene/dev/trunk/solr/core/src/test/org/apache/solr/cloud/ChaosMonkeyNothingIsSafeTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/core/src/test/org/apache/solr/cloud/ChaosMonkeyNothingIsSafeTest.java?rev=1545409&r1=1545408&r2=1545409&view=diff
==============================================================================
--- lucene/dev/trunk/solr/core/src/test/org/apache/solr/cloud/ChaosMonkeyNothingIsSafeTest.java (original)
+++ lucene/dev/trunk/solr/core/src/test/org/apache/solr/cloud/ChaosMonkeyNothingIsSafeTest.java Mon Nov 25 21:14:11 2013
@@ -138,7 +138,7 @@ public class ChaosMonkeyNothingIsSafeTes
         ftIndexThread.start();
       }
       
-      chaosMonkey.startTheMonkey(true, 10000);
+      chaosMonkey.startTheMonkey(true, true, 10000);
 
       long runLength;
       if (RUN_LENGTH != -1) {
@@ -158,18 +158,13 @@ public class ChaosMonkeyNothingIsSafeTes
         indexThread.safeStop();
       }
       
+      // start any downed jetties to be sure we still will end up with a leader per shard...
+      
       // wait for stop...
       for (StopableThread indexThread : threads) {
         indexThread.join();
       }
       
-       // we expect full throttle fails, but cloud client should not easily fail
-       for (StopableThread indexThread : threads) {
-         if (indexThread instanceof StopableIndexingThread && !(indexThread instanceof FullThrottleStopableIndexingThread)) {
-           assertEquals(0, ((StopableIndexingThread) indexThread).getFails());
-         }
-       }
-      
       // try and wait for any replications and what not to finish...
       
       Thread.sleep(2000);
@@ -190,6 +185,13 @@ public class ChaosMonkeyNothingIsSafeTes
       assertTrue(zkStateReader.getClusterState().getLiveNodes().size() > 0);
       
       
+      // we expect full throttle fails, but cloud client should not easily fail
+      for (StopableThread indexThread : threads) {
+        if (indexThread instanceof StopableIndexingThread && !(indexThread instanceof FullThrottleStopableIndexingThread)) {
+          assertEquals("There were expected update fails", 0, ((StopableIndexingThread) indexThread).getFails());
+        }
+      }
+      
       // full throttle thread can
       // have request fails 
       checkShardConsistency(!runFullThrottle, true);

Modified: lucene/dev/trunk/solr/core/src/test/org/apache/solr/cloud/ChaosMonkeySafeLeaderTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/core/src/test/org/apache/solr/cloud/ChaosMonkeySafeLeaderTest.java?rev=1545409&r1=1545408&r2=1545409&view=diff
==============================================================================
--- lucene/dev/trunk/solr/core/src/test/org/apache/solr/cloud/ChaosMonkeySafeLeaderTest.java (original)
+++ lucene/dev/trunk/solr/core/src/test/org/apache/solr/cloud/ChaosMonkeySafeLeaderTest.java Mon Nov 25 21:14:11 2013
@@ -99,7 +99,7 @@ public class ChaosMonkeySafeLeaderTest e
       indexThread.start();
     }
     
-    chaosMonkey.startTheMonkey(false, 500);
+    chaosMonkey.startTheMonkey(false, false, 500);
     long runLength;
     if (RUN_LENGTH != -1) {
       runLength = RUN_LENGTH;

Modified: lucene/dev/trunk/solr/test-framework/src/java/org/apache/solr/cloud/ChaosMonkey.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/test-framework/src/java/org/apache/solr/cloud/ChaosMonkey.java?rev=1545409&r1=1545408&r2=1545409&view=diff
==============================================================================
--- lucene/dev/trunk/solr/test-framework/src/java/org/apache/solr/cloud/ChaosMonkey.java (original)
+++ lucene/dev/trunk/solr/test-framework/src/java/org/apache/solr/cloud/ChaosMonkey.java Mon Nov 25 21:14:11 2013
@@ -435,7 +435,7 @@ public class ChaosMonkey {
   
   // synchronously starts and stops shards randomly, unless there is only one
   // active shard up for a slice or if there is one active and others recovering
-  public void startTheMonkey(boolean killLeaders, final int roundPauseUpperLimit) {
+  public void startTheMonkey(boolean killLeaders, final boolean startDeadPool, final int roundPauseUpperLimit) {
     if (!MONKEY_ENABLED) {
       monkeyLog("The Monkey is disabled and will not start");
       return;
@@ -503,6 +503,16 @@ public class ChaosMonkey {
         monkeyLog("I ran for " + (System.currentTimeMillis() - startTime)/1000.0f + "sec. I stopped " + stops + " and I started " + starts
             + ". I also expired " + expires.get() + " and caused " + connloss
             + " connection losses");
+        if (startDeadPool) {
+          // starting down nodes
+          for (CloudJettyRunner jetty : deadPool) {
+            try {
+              if (jetty.jetty.isStopped()) ChaosMonkey.start(jetty.jetty);
+            } catch (Exception e) {
+              log.error("", e);
+            }
+          }
+        }
       }
     };
     monkeyThread.start();