Skip to content

Commit 2c35db8

Browse files
committed
TEST: Avoid merges in testSeqNoAndCheckpoints
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
1 parent 08e4f4b commit 2c35db8

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

server/src/test/java/org/elasticsearch/index/engine/InternalEngineTests.java

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2024,7 +2024,6 @@ public void testIndexWriterInfoStream() throws IllegalAccessException, IOExcepti
20242024
}
20252025
}
20262026

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

20392040
try {
2040-
initialEngine = engine;
2041+
initialEngine = createEngine(defaultSettings, store, createTempDir(), newLogMergePolicy(), null);
20412042
final ShardRouting primary = TestShardRouting.newShardRouting("test", shardId.id(), "node1", null, true,
20422043
ShardRoutingState.STARTED, allocationId);
20432044
final ShardRouting replica = TestShardRouting.newShardRouting(shardId, "node2", false, ShardRoutingState.STARTED);
@@ -2053,7 +2054,7 @@ public void testSeqNoAndCheckpoints() throws IOException {
20532054
// we have some docs indexed, so delete one of them
20542055
id = randomFrom(indexedIds);
20552056
final Engine.Delete delete = new Engine.Delete(
2056-
"test", id, newUid(id), SequenceNumbers.UNASSIGNED_SEQ_NO, 0,
2057+
"test", id, newUid(id), SequenceNumbers.UNASSIGNED_SEQ_NO, primaryTerm.get(),
20572058
rarely() ? 100 : Versions.MATCH_ANY, VersionType.INTERNAL, PRIMARY, 0);
20582059
final Engine.DeleteResult result = initialEngine.delete(delete);
20592060
if (result.getResultType() == Engine.Result.Type.SUCCESS) {
@@ -2070,7 +2071,7 @@ public void testSeqNoAndCheckpoints() throws IOException {
20702071
id = randomFrom(ids);
20712072
ParsedDocument doc = testParsedDocument(id, null, testDocumentWithTextField(), SOURCE, null);
20722073
final Engine.Index index = new Engine.Index(newUid(doc), doc,
2073-
SequenceNumbers.UNASSIGNED_SEQ_NO, 0,
2074+
SequenceNumbers.UNASSIGNED_SEQ_NO, primaryTerm.get(),
20742075
rarely() ? 100 : Versions.MATCH_ANY, VersionType.INTERNAL,
20752076
PRIMARY, 0, -1, false);
20762077
final Engine.IndexResult result = initialEngine.index(index);

0 commit comments

Comments
 (0)