mirror of https://github.com/apache/lucene.git
SOLR-5989: Pass add and delete fails to checkShardConsistency call in ChaosMonkeyNothingisSafeTest so that legal differences are ignored.
git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1588403 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
389a4b93dc
commit
abed84e836
|
@ -19,6 +19,7 @@ package org.apache.solr.cloud;
|
|||
|
||||
import java.net.ConnectException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
|
@ -128,11 +129,13 @@ public class ChaosMonkeyNothingIsSafeTest extends AbstractFullDistribZkTestBase
|
|||
del("*:*");
|
||||
|
||||
List<StopableThread> threads = new ArrayList<>();
|
||||
List<StopableIndexingThread> indexTreads = new ArrayList<>();
|
||||
int threadCount = TEST_NIGHTLY ? 3 : 1;
|
||||
int i = 0;
|
||||
for (i = 0; i < threadCount; i++) {
|
||||
StopableIndexingThread indexThread = new StopableIndexingThread(controlClient, cloudClient, Integer.toString(i), true);
|
||||
threads.add(indexThread);
|
||||
indexTreads.add(indexThread);
|
||||
indexThread.start();
|
||||
}
|
||||
|
||||
|
@ -213,9 +216,12 @@ public class ChaosMonkeyNothingIsSafeTest extends AbstractFullDistribZkTestBase
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
Set<String> addFails = getAddFails(indexTreads);
|
||||
Set<String> deleteFails = getDeleteFails(indexTreads);
|
||||
// full throttle thread can
|
||||
// have request fails
|
||||
checkShardConsistency(!runFullThrottle, true);
|
||||
checkShardConsistency(!runFullThrottle, true, addFails, deleteFails);
|
||||
|
||||
long ctrlDocs = controlClient.query(new SolrQuery("*:*")).getResults()
|
||||
.getNumFound();
|
||||
|
@ -250,7 +256,7 @@ public class ChaosMonkeyNothingIsSafeTest extends AbstractFullDistribZkTestBase
|
|||
List<Integer> numShardsNumReplicas = new ArrayList<>(2);
|
||||
numShardsNumReplicas.add(1);
|
||||
numShardsNumReplicas.add(1);
|
||||
checkForCollection("testcollection",numShardsNumReplicas, null);
|
||||
checkForCollection("testcollection", numShardsNumReplicas, null);
|
||||
|
||||
testsSuccesful = true;
|
||||
} finally {
|
||||
|
@ -260,6 +266,22 @@ public class ChaosMonkeyNothingIsSafeTest extends AbstractFullDistribZkTestBase
|
|||
}
|
||||
}
|
||||
|
||||
private Set<String> getAddFails(List<StopableIndexingThread> threads) {
|
||||
Set<String> addFails = new HashSet<String>();
|
||||
for (StopableIndexingThread thread : threads) {
|
||||
addFails.addAll(thread.getAddFails());
|
||||
}
|
||||
return addFails;
|
||||
}
|
||||
|
||||
private Set<String> getDeleteFails(List<StopableIndexingThread> threads) {
|
||||
Set<String> deleteFails = new HashSet<String>();
|
||||
for (StopableIndexingThread thread : threads) {
|
||||
deleteFails.addAll(thread.getDeleteFails());
|
||||
}
|
||||
return deleteFails;
|
||||
}
|
||||
|
||||
class FullThrottleStopableIndexingThread extends StopableIndexingThread {
|
||||
private HttpClient httpClient = HttpClientUtil.createClient(null);
|
||||
private volatile boolean stop = false;
|
||||
|
|
|
@ -1133,10 +1133,7 @@ public abstract class AbstractFullDistribZkTestBase extends AbstractDistribZkTes
|
|||
return sb.toString();
|
||||
}
|
||||
|
||||
boolean checkForLegalDiff(SolrDocumentList a, SolrDocumentList b, String aName, String bName, Set<String> addFails, Set<String> deleteFails) {
|
||||
// System.err.println("######"+aName+ ": " + toStr(a,10));
|
||||
// System.err.println("######"+bName+ ": " + toStr(b,10));
|
||||
//System.err.println("###### sizes=" + a.size() + "," + b.size());
|
||||
boolean checkIfDiffIsLegal(SolrDocumentList a, SolrDocumentList b, String aName, String bName, Set<String> addFails, Set<String> deleteFails) {
|
||||
boolean legal = true;
|
||||
Set<SolrDocument> setA = new HashSet<>();
|
||||
for (SolrDocument sdoc : a) {
|
||||
|
@ -1321,7 +1318,7 @@ public abstract class AbstractFullDistribZkTestBase extends AbstractDistribZkTes
|
|||
};
|
||||
|
||||
if (addFails != null || deleteFails != null) {
|
||||
boolean legal = checkForLegalDiff(controlDocList, cloudDocList,
|
||||
boolean legal = checkIfDiffIsLegal(controlDocList, cloudDocList,
|
||||
"controlDocList", "cloudDocList", addFails, deleteFails);
|
||||
if (legal) {
|
||||
return false;
|
||||
|
|
Loading…
Reference in New Issue