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/03 16:55:12 UTC
svn commit: r1538393 - in /lucene/dev/branches/branch_4x: ./ solr/
solr/test-framework/
solr/test-framework/src/java/org/apache/solr/cloud/ChaosMonkey.java
Author: markrmiller
Date: Sun Nov 3 15:55:12 2013
New Revision: 1538393
URL: http://svn.apache.org/r1538393
Log:
tests: allow the monkey to be disabled and bring back some randomization to exp and conn loss
Modified:
lucene/dev/branches/branch_4x/ (props changed)
lucene/dev/branches/branch_4x/solr/ (props changed)
lucene/dev/branches/branch_4x/solr/test-framework/ (props changed)
lucene/dev/branches/branch_4x/solr/test-framework/src/java/org/apache/solr/cloud/ChaosMonkey.java
Modified: lucene/dev/branches/branch_4x/solr/test-framework/src/java/org/apache/solr/cloud/ChaosMonkey.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/solr/test-framework/src/java/org/apache/solr/cloud/ChaosMonkey.java?rev=1538393&r1=1538392&r2=1538393&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/solr/test-framework/src/java/org/apache/solr/cloud/ChaosMonkey.java (original)
+++ lucene/dev/branches/branch_4x/solr/test-framework/src/java/org/apache/solr/cloud/ChaosMonkey.java Sun Nov 3 15:55:12 2013
@@ -56,8 +56,9 @@ public class ChaosMonkey {
private static final int EXPIRE_PERCENT = 10; // 0 - 10 = 0 - 100%
private Map<String,List<CloudJettyRunner>> shardToJetty;
- private static final boolean CONN_LOSS = Boolean.valueOf(System.getProperty("solr.tests.cloud.cm.connloss", "true"));
- private static final boolean EXP = Boolean.valueOf(System.getProperty("solr.tests.cloud.cm.exp", "true"));
+ private static final Boolean MONKEY_ENABLED = Boolean.valueOf(System.getProperty("solr.tests.cloud.cm.enabled", "true"));
+ private static final Boolean CONN_LOSS = Boolean.valueOf(System.getProperty("solr.tests.cloud.cm.connloss", null));
+ private static final Boolean EXP = Boolean.valueOf(System.getProperty("solr.tests.cloud.cm.exp", null));
private ZkTestServer zkServer;
private ZkStateReader zkStateReader;
@@ -85,10 +86,25 @@ public class ChaosMonkey {
this.zkServer = zkServer;
this.zkStateReader = zkStateReader;
this.collection = collection;
+
+ if (!MONKEY_ENABLED) {
+ monkeyLog("The Monkey is Disabled and will not run");
+ return;
+ }
+
Random random = LuceneTestCase.random();
- expireSessions = EXP; //= random.nextBoolean();
+ if (EXP != null) {
+ expireSessions = EXP;
+ } else {
+ expireSessions = random.nextBoolean();
+ }
+ if (CONN_LOSS != null) {
+ causeConnectionLoss = CONN_LOSS;
+ } else {
+ causeConnectionLoss = random.nextBoolean();
+ }
+
- causeConnectionLoss = CONN_LOSS;//= random.nextBoolean();
monkeyLog("init - expire sessions:" + expireSessions
+ " cause connection loss:" + causeConnectionLoss);
}
@@ -420,6 +436,10 @@ 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) {
+ if (!MONKEY_ENABLED) {
+ monkeyLog("The Monkey is disabled and will not start");
+ return;
+ }
monkeyLog("starting");
this.aggressivelyKillLeaders = killLeaders;
startTime = System.currentTimeMillis();