@@ -4559,7 +4559,6 @@ public void testRestoreLocalHistoryFromTranslog() throws IOException {
4559
4559
final EngineConfig engineConfig ;
4560
4560
final SeqNoStats prevSeqNoStats ;
4561
4561
final List <DocIdSeqNoAndSource > prevDocs ;
4562
- final List <Translog .Operation > existingTranslog ;
4563
4562
try (InternalEngine engine = createEngine (store , createTempDir (), globalCheckpoint ::get )) {
4564
4563
engineConfig = engine .config ();
4565
4564
for (final long seqNo : seqNos ) {
@@ -4578,24 +4577,17 @@ public void testRestoreLocalHistoryFromTranslog() throws IOException {
4578
4577
engine .syncTranslog ();
4579
4578
prevSeqNoStats = engine .getSeqNoStats (globalCheckpoint .get ());
4580
4579
prevDocs = getDocIds (engine , true );
4581
- try (Translog .Snapshot snapshot = engine .getTranslog ().newSnapshot ()) {
4582
- existingTranslog = TestTranslog .drainSnapshot (snapshot , false );
4583
- }
4584
4580
}
4585
4581
try (InternalEngine engine = new InternalEngine (engineConfig )) {
4586
- final Translog .TranslogGeneration currrentTranslogGeneration = new Translog .TranslogGeneration (
4587
- engine .getTranslog ().getTranslogUUID (), engine .getTranslog ().currentFileGeneration ());
4582
+ final long currentTranslogGeneration = engine .getTranslog ().currentFileGeneration ();
4588
4583
engine .recoverFromTranslog (translogHandler , globalCheckpoint .get ());
4589
4584
engine .restoreLocalHistoryFromTranslog (translogHandler );
4590
4585
assertThat (getDocIds (engine , true ), equalTo (prevDocs ));
4591
4586
SeqNoStats seqNoStats = engine .getSeqNoStats (globalCheckpoint .get ());
4592
4587
assertThat (seqNoStats .getLocalCheckpoint (), equalTo (prevSeqNoStats .getLocalCheckpoint ()));
4593
4588
assertThat (seqNoStats .getMaxSeqNo (), equalTo (prevSeqNoStats .getMaxSeqNo ()));
4594
- try (Translog .Snapshot snapshot = engine .getTranslog ().newSnapshot ()) {
4595
- assertThat ("restore from local translog must not add operations to translog" ,
4596
- snapshot .totalOperations (), equalTo (existingTranslog .size ()));
4597
- assertThat (TestTranslog .drainSnapshot (snapshot , false ), equalTo (existingTranslog ));
4598
- }
4589
+ assertThat ("restore from local translog must not add operations to translog" ,
4590
+ engine .getTranslog ().totalOperationsByMinGen (currentTranslogGeneration ), equalTo (0 ));
4599
4591
}
4600
4592
assertConsistentHistoryBetweenTranslogAndLuceneIndex (engine , createMapperService ("test" ));
4601
4593
}
@@ -6038,6 +6030,7 @@ public void testRecoverFromLocalTranslog() throws Exception {
6038
6030
docs = getDocIds (engine , true );
6039
6031
}
6040
6032
try (InternalEngine engine = new InternalEngine (config )) {
6033
+ engine .onSettingsChanged (TimeValue .MINUS_ONE , ByteSizeValue .ZERO , 0 );
6041
6034
engine .recoverFromTranslog (translogHandler , Long .MAX_VALUE );
6042
6035
assertThat (getDocIds (engine , randomBoolean ()), equalTo (docs ));
6043
6036
if (engine .getSeqNoStats (globalCheckpoint .get ()).getMaxSeqNo () == globalCheckpoint .get ()) {
0 commit comments