SOLR-10841: TestTlogReplica.testRecovery sometimes fails

This commit is contained in:
Cao Manh Dat 2018-05-21 09:05:13 +07:00
parent d91273ddf0
commit 39256e8348
1 changed files with 14 additions and 2 deletions

View File

@ -593,14 +593,26 @@ public class TestTlogReplica extends SolrCloudTestCase {
}
ChaosMonkey.start(solrRunner);
waitingForReplay.acquire();
// If I add the doc immediately, the leader fails to communicate with the follower with broken pipe.
// Options are, wait or retry...
for (int i = 0; i < 3; i++) {
UpdateRequest ureq = new UpdateRequest().add(sdoc("id", "8"));
ureq.setParam("collection", collectionName);
ureq.setParam(UpdateRequest.MIN_REPFACT, "2");
NamedList<Object> response = cloudClient.request(ureq);
if ((Integer)((NamedList<Object>)response.get("responseHeader")).get(UpdateRequest.REPFACT) >= 2) {
break;
}
LOG.info("Min RF not achieved yet. retrying");
}
new UpdateRequest()
.add(sdoc("id", "8"))
.add(sdoc("id", "9"))
.add(sdoc("id", "10"))
.process(cloudClient, collectionName);
waitingForBufferUpdates.release();
RecoveryStrategy.testing_beforeReplayBufferingUpdates = null;
waitForState("Replica didn't recover", collectionName, activeReplicaCount(0,2,0));
checkRTG(3,9, cluster.getJettySolrRunners());
checkRTG(3,10, cluster.getJettySolrRunners());
for (SolrCore solrCore : getSolrCore(false)) {
RefCounted<IndexWriter> iwRef = solrCore.getUpdateHandler().getSolrCoreState().getIndexWriter(null);
assertFalse("IndexWriter at replicas must not see updates ", iwRef.get().hasUncommittedChanges());