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
This commit is contained in:
parent
08e4f4be42
commit
2c35db8043
|
@ -2024,7 +2024,6 @@ public class InternalEngineTests extends EngineTestCase {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@AwaitsFix(bugUrl = "https://github.com/elastic/elasticsearch/issues/32430")
|
|
||||||
public void testSeqNoAndCheckpoints() throws IOException {
|
public void testSeqNoAndCheckpoints() throws IOException {
|
||||||
final int opCount = randomIntBetween(1, 256);
|
final int opCount = randomIntBetween(1, 256);
|
||||||
long primarySeqNo = SequenceNumbers.NO_OPS_PERFORMED;
|
long primarySeqNo = SequenceNumbers.NO_OPS_PERFORMED;
|
||||||
|
@ -2034,10 +2033,12 @@ public class InternalEngineTests extends EngineTestCase {
|
||||||
long replicaLocalCheckpoint = SequenceNumbers.NO_OPS_PERFORMED;
|
long replicaLocalCheckpoint = SequenceNumbers.NO_OPS_PERFORMED;
|
||||||
final long globalCheckpoint;
|
final long globalCheckpoint;
|
||||||
long maxSeqNo = SequenceNumbers.NO_OPS_PERFORMED;
|
long maxSeqNo = SequenceNumbers.NO_OPS_PERFORMED;
|
||||||
|
IOUtils.close(store, engine);
|
||||||
|
store = createStore();
|
||||||
InternalEngine initialEngine = null;
|
InternalEngine initialEngine = null;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
initialEngine = engine;
|
initialEngine = createEngine(defaultSettings, store, createTempDir(), newLogMergePolicy(), null);
|
||||||
final ShardRouting primary = TestShardRouting.newShardRouting("test", shardId.id(), "node1", null, true,
|
final ShardRouting primary = TestShardRouting.newShardRouting("test", shardId.id(), "node1", null, true,
|
||||||
ShardRoutingState.STARTED, allocationId);
|
ShardRoutingState.STARTED, allocationId);
|
||||||
final ShardRouting replica = TestShardRouting.newShardRouting(shardId, "node2", false, ShardRoutingState.STARTED);
|
final ShardRouting replica = TestShardRouting.newShardRouting(shardId, "node2", false, ShardRoutingState.STARTED);
|
||||||
|
@ -2053,7 +2054,7 @@ public class InternalEngineTests extends EngineTestCase {
|
||||||
// we have some docs indexed, so delete one of them
|
// we have some docs indexed, so delete one of them
|
||||||
id = randomFrom(indexedIds);
|
id = randomFrom(indexedIds);
|
||||||
final Engine.Delete delete = new Engine.Delete(
|
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);
|
rarely() ? 100 : Versions.MATCH_ANY, VersionType.INTERNAL, PRIMARY, 0);
|
||||||
final Engine.DeleteResult result = initialEngine.delete(delete);
|
final Engine.DeleteResult result = initialEngine.delete(delete);
|
||||||
if (result.getResultType() == Engine.Result.Type.SUCCESS) {
|
if (result.getResultType() == Engine.Result.Type.SUCCESS) {
|
||||||
|
@ -2070,7 +2071,7 @@ public class InternalEngineTests extends EngineTestCase {
|
||||||
id = randomFrom(ids);
|
id = randomFrom(ids);
|
||||||
ParsedDocument doc = testParsedDocument(id, null, testDocumentWithTextField(), SOURCE, null);
|
ParsedDocument doc = testParsedDocument(id, null, testDocumentWithTextField(), SOURCE, null);
|
||||||
final Engine.Index index = new Engine.Index(newUid(doc), doc,
|
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,
|
rarely() ? 100 : Versions.MATCH_ANY, VersionType.INTERNAL,
|
||||||
PRIMARY, 0, -1, false);
|
PRIMARY, 0, -1, false);
|
||||||
final Engine.IndexResult result = initialEngine.index(index);
|
final Engine.IndexResult result = initialEngine.index(index);
|
||||||
|
|
Loading…
Reference in New Issue