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.
This commit is contained in:
Nhat Nguyen 2019-02-11 13:12:05 -05:00
parent eca5404572
commit 4a5070dcfb
1 changed files with 2 additions and 2 deletions

View File

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