mirror of https://github.com/apache/lucene.git
SOLR-5888: Speed up SyncSliceTest as well as some other tests.
git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1579539 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
aa47364ce4
commit
2ce105ed45
|
@ -313,7 +313,7 @@ public class ChaosMonkeyNothingIsSafeTest extends AbstractFullDistribZkTestBase
|
|||
|
||||
try {
|
||||
numAdds++;
|
||||
if (numAdds > 4000)
|
||||
if (numAdds > (TEST_NIGHTLY ? 4002 : 197))
|
||||
continue;
|
||||
SolrInputDocument doc = getDoc(
|
||||
"id",
|
||||
|
|
|
@ -164,10 +164,10 @@ public class SyncSliceTest extends AbstractFullDistribZkTestBase {
|
|||
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 AbstractFullDistribZkTestBase {
|
|||
// 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 AbstractFullDistribZkTestBase {
|
|||
// 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 AbstractFullDistribZkTestBase {
|
|||
}
|
||||
}
|
||||
printLayout();
|
||||
fail("timeout waiting to see recovered node");
|
||||
fail("timeout waiting to see all nodes active");
|
||||
}
|
||||
|
||||
private String waitTillInconsistent() throws Exception, InterruptedException {
|
||||
|
|
|
@ -1510,7 +1510,43 @@ public abstract class AbstractFullDistribZkTestBase extends AbstractDistribZkTes
|
|||
}
|
||||
|
||||
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;
|
||||
|
|
Loading…
Reference in New Issue