Skip to content

Commit

Permalink
TEST: Avoid merges in testSeqNoAndCheckpoints
Browse files Browse the repository at this point in the history
Since LUCENE-8263, testSeqNoAndCheckpoints might trigger merges because
of the updates and deletes in the test. Our merge scheduler will trigger
a flush if there is no pending merge. Those extra flushes will change
the last committed segmentInfos in the engine and fail the test.

This commit uses LogMergePolicy for the engine in the test to avoid
merges.

Closes #32430
  • Loading branch information
dnhatn committed Aug 2, 2018
1 parent 08e4f4b commit 2c35db8
Showing 1 changed file with 5 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2024,7 +2024,6 @@ public void testIndexWriterInfoStream() throws IllegalAccessException, IOExcepti
}
}

@AwaitsFix(bugUrl = "https://github.com/elastic/elasticsearch/issues/32430")
public void testSeqNoAndCheckpoints() throws IOException {
final int opCount = randomIntBetween(1, 256);
long primarySeqNo = SequenceNumbers.NO_OPS_PERFORMED;
Expand All @@ -2034,10 +2033,12 @@ public void testSeqNoAndCheckpoints() throws IOException {
long replicaLocalCheckpoint = SequenceNumbers.NO_OPS_PERFORMED;
final long globalCheckpoint;
long maxSeqNo = SequenceNumbers.NO_OPS_PERFORMED;
IOUtils.close(store, engine);
store = createStore();
InternalEngine initialEngine = null;

try {
initialEngine = engine;
initialEngine = createEngine(defaultSettings, store, createTempDir(), newLogMergePolicy(), null);
final ShardRouting primary = TestShardRouting.newShardRouting("test", shardId.id(), "node1", null, true,
ShardRoutingState.STARTED, allocationId);
final ShardRouting replica = TestShardRouting.newShardRouting(shardId, "node2", false, ShardRoutingState.STARTED);
Expand All @@ -2053,7 +2054,7 @@ public void testSeqNoAndCheckpoints() throws IOException {
// we have some docs indexed, so delete one of them
id = randomFrom(indexedIds);
final Engine.Delete delete = new Engine.Delete(
"test", id, newUid(id), SequenceNumbers.UNASSIGNED_SEQ_NO, 0,
"test", id, newUid(id), SequenceNumbers.UNASSIGNED_SEQ_NO, primaryTerm.get(),
rarely() ? 100 : Versions.MATCH_ANY, VersionType.INTERNAL, PRIMARY, 0);
final Engine.DeleteResult result = initialEngine.delete(delete);
if (result.getResultType() == Engine.Result.Type.SUCCESS) {
Expand All @@ -2070,7 +2071,7 @@ public void testSeqNoAndCheckpoints() throws IOException {
id = randomFrom(ids);
ParsedDocument doc = testParsedDocument(id, null, testDocumentWithTextField(), SOURCE, null);
final Engine.Index index = new Engine.Index(newUid(doc), doc,
SequenceNumbers.UNASSIGNED_SEQ_NO, 0,
SequenceNumbers.UNASSIGNED_SEQ_NO, primaryTerm.get(),
rarely() ? 100 : Versions.MATCH_ANY, VersionType.INTERNAL,
PRIMARY, 0, -1, false);
final Engine.IndexResult result = initialEngine.index(index);
Expand Down

0 comments on commit 2c35db8

Please sign in to comment.