Skip to content

Commit 96f68c8

Browse files
committed
Use current term in initial leases in engine test (#38285)
We need to use the current primary term instead of 1L for the initial retention leases; otherwise, the primary term of the committed retention leases won't match the current primary term if the retention leases never gets updated.
1 parent 6fab813 commit 96f68c8

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5319,7 +5319,6 @@ private void assertOperationHistoryInLucene(List<Engine.Operation> operations) t
53195319
}
53205320
}
53215321

5322-
@AwaitsFix(bugUrl="https://github.com/elastic/elasticsearch/pull/38285")
53235322
public void testKeepMinRetainedSeqNoByMergePolicy() throws IOException {
53245323
IOUtils.close(engine, store);
53255324
Settings.Builder settings = Settings.builder()
@@ -5331,7 +5330,8 @@ public void testKeepMinRetainedSeqNoByMergePolicy() throws IOException {
53315330
final AtomicLong globalCheckpoint = new AtomicLong(SequenceNumbers.NO_OPS_PERFORMED);
53325331
final long primaryTerm = randomLongBetween(1, Long.MAX_VALUE);
53335332
final AtomicLong retentionLeasesVersion = new AtomicLong();
5334-
final AtomicReference<RetentionLeases> retentionLeasesHolder = new AtomicReference<>(RetentionLeases.EMPTY);
5333+
final AtomicReference<RetentionLeases> retentionLeasesHolder = new AtomicReference<>(
5334+
new RetentionLeases(primaryTerm, retentionLeasesVersion.get(), Collections.emptyList()));
53355335
final List<Engine.Operation> operations = generateSingleDocHistory(true,
53365336
randomFrom(VersionType.INTERNAL, VersionType.EXTERNAL), false, 2, 10, 300, "2");
53375337
Randomness.shuffle(operations);

0 commit comments

Comments
 (0)