SOLR-5573: ChaosMonkey should randomly turn off Solr's commit on shutdown option.

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1553159 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Mark Robert Miller 2013-12-23 17:34:24 +00:00
parent be7d4f195f
commit 227ce7c228
3 changed files with 29 additions and 16 deletions

View File

@ -150,16 +150,16 @@ public class ChaosMonkeyNothingIsSafeTest extends AbstractFullDistribZkTestBase
}
chaosMonkey.startTheMonkey(true, 10000);
long runLength;
if (RUN_LENGTH != -1) {
runLength = RUN_LENGTH;
} else {
int[] runTimes = new int[] {5000,6000,10000,15000,25000,30000,30000,45000,90000,120000};
runLength = runTimes[random().nextInt(runTimes.length - 1)];
}
try {
long runLength;
if (RUN_LENGTH != -1) {
runLength = RUN_LENGTH;
} else {
int[] runTimes = new int[] {5000, 6000, 10000, 15000, 25000, 30000,
30000, 45000, 90000, 120000};
runLength = runTimes[random().nextInt(runTimes.length - 1)];
}
Thread.sleep(runLength);
} finally {
chaosMonkey.stopTheMonkey();

View File

@ -112,14 +112,16 @@ public class ChaosMonkeySafeLeaderTest extends AbstractFullDistribZkTestBase {
}
chaosMonkey.startTheMonkey(false, 500);
long runLength;
if (RUN_LENGTH != -1) {
runLength = RUN_LENGTH;
} else {
int[] runTimes = new int[] {5000,6000,10000,25000,27000,30000,30000,45000,90000,120000};
runLength = runTimes[random().nextInt(runTimes.length - 1)];
}
try {
long runLength;
if (RUN_LENGTH != -1) {
runLength = RUN_LENGTH;
} else {
int[] runTimes = new int[] {5000, 6000, 10000, 25000, 27000, 30000,
30000, 45000, 90000, 120000};
runLength = runTimes[random().nextInt(runTimes.length - 1)];
}
Thread.sleep(runLength);
} finally {
chaosMonkey.stopTheMonkey();

View File

@ -37,6 +37,7 @@ import org.apache.solr.common.cloud.ZkStateReader;
import org.apache.solr.core.CoreContainer;
import org.apache.solr.core.SolrCore;
import org.apache.solr.servlet.SolrDispatchFilter;
import org.apache.solr.update.DirectUpdateHandler2;
import org.apache.zookeeper.KeeperException;
import org.eclipse.jetty.servlet.FilterHolder;
import org.slf4j.Logger;
@ -459,6 +460,13 @@ public class ChaosMonkey {
return;
}
monkeyLog("starting");
if (LuceneTestCase.random().nextBoolean()) {
monkeyLog("Jetty will not commit on shutdown");
DirectUpdateHandler2.commitOnClose = false;
}
this.aggressivelyKillLeaders = killLeaders;
startTime = System.currentTimeMillis();
// TODO: when kill leaders is on, lets kill a higher percentage of leaders
@ -537,6 +545,9 @@ public class ChaosMonkey {
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
}
DirectUpdateHandler2.commitOnClose = true;
float runtime = (System.currentTimeMillis() - startTime)/1000.0f;
if (runtime > 20 && stops.get() == 0) {
LuceneTestCase.fail("The Monkey ran for over 20 seconds and no jetties were stopped - this is worth investigating!");