TEST: Update translog gen of the last commit
The test testWithRandomException was not updated accordingly to the latest translog policy. Method setTranslogGenerationOfLastCommit should be called before whenever setMinTranslogGenerationForRecovery is called. Relates #27606
This commit is contained in:
parent
57fc705d5e
commit
55738ac1b9
|
@ -108,7 +108,6 @@ import java.util.concurrent.atomic.AtomicLong;
|
|||
import java.util.stream.Collectors;
|
||||
import java.util.stream.LongStream;
|
||||
|
||||
import static com.carrotsearch.randomizedtesting.RandomizedTest.randomLongBetween;
|
||||
import static org.elasticsearch.common.util.BigArrays.NON_RECYCLING_INSTANCE;
|
||||
import static org.elasticsearch.index.translog.SnapshotMatchers.containsOperationsInAnyOrder;
|
||||
import static org.elasticsearch.index.translog.TranslogDeletionPolicies.createTranslogDeletionPolicy;
|
||||
|
@ -2224,6 +2223,7 @@ public class TranslogTests extends ESTestCase {
|
|||
unsynced.clear();
|
||||
failableTLog.rollGeneration();
|
||||
committing = true;
|
||||
failableTLog.getDeletionPolicy().setTranslogGenerationOfLastCommit(failableTLog.currentFileGeneration());
|
||||
failableTLog.getDeletionPolicy().setMinTranslogGenerationForRecovery(failableTLog.currentFileGeneration());
|
||||
failableTLog.trimUnreferencedReaders();
|
||||
committing = false;
|
||||
|
@ -2266,6 +2266,7 @@ public class TranslogTests extends ESTestCase {
|
|||
if (randomBoolean()) {
|
||||
try {
|
||||
TranslogDeletionPolicy deletionPolicy = createTranslogDeletionPolicy();
|
||||
deletionPolicy.setTranslogGenerationOfLastCommit(minGenForRecovery);
|
||||
deletionPolicy.setMinTranslogGenerationForRecovery(minGenForRecovery);
|
||||
IOUtils.close(getFailableTranslog(fail, config, randomBoolean(), false, generationUUID, deletionPolicy));
|
||||
} catch (TranslogException | MockDirectoryWrapper.FakeIOException ex) {
|
||||
|
@ -2277,6 +2278,7 @@ public class TranslogTests extends ESTestCase {
|
|||
|
||||
fail.failNever(); // we don't wanna fail here but we might since we write a new checkpoint and create a new tlog file
|
||||
TranslogDeletionPolicy deletionPolicy = createTranslogDeletionPolicy();
|
||||
deletionPolicy.setTranslogGenerationOfLastCommit(minGenForRecovery);
|
||||
deletionPolicy.setMinTranslogGenerationForRecovery(minGenForRecovery);
|
||||
try (Translog translog = new Translog(config, generationUUID, deletionPolicy, () -> SequenceNumbers.UNASSIGNED_SEQ_NO);
|
||||
Translog.Snapshot snapshot = translog.newSnapshotFromGen(minGenForRecovery)) {
|
||||
|
|
Loading…
Reference in New Issue