Skip to content

Commit 4a5070d

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 eca5404 commit 4a5070d

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
@@ -5296,7 +5296,6 @@ private void assertOperationHistoryInLucene(List<Engine.Operation> operations) t
52965296
}
52975297
}
52985298

5299-
@AwaitsFix(bugUrl="https://github.com/elastic/elasticsearch/pull/38285")
53005299
public void testKeepMinRetainedSeqNoByMergePolicy() throws IOException {
53015300
IOUtils.close(engine, store);
53025301
Settings.Builder settings = Settings.builder()
@@ -5308,7 +5307,8 @@ public void testKeepMinRetainedSeqNoByMergePolicy() throws IOException {
53085307
final AtomicLong globalCheckpoint = new AtomicLong(SequenceNumbers.NO_OPS_PERFORMED);
53095308
final long primaryTerm = randomLongBetween(1, Long.MAX_VALUE);
53105309
final AtomicLong retentionLeasesVersion = new AtomicLong();
5311-
final AtomicReference<RetentionLeases> retentionLeasesHolder = new AtomicReference<>(RetentionLeases.EMPTY);
5310+
final AtomicReference<RetentionLeases> retentionLeasesHolder = new AtomicReference<>(
5311+
new RetentionLeases(primaryTerm, retentionLeasesVersion.get(), Collections.emptyList()));
53125312
final List<Engine.Operation> operations = generateSingleDocHistory(true,
53135313
randomFrom(VersionType.INTERNAL, VersionType.EXTERNAL), 2, 10, 300, "2");
53145314
Randomness.shuffle(operations);

0 commit comments

Comments
 (0)