@@ -4207,7 +4207,6 @@ public void testRestoreLocalHistoryFromTranslog() throws IOException {
4207
4207
final EngineConfig engineConfig ;
4208
4208
final SeqNoStats prevSeqNoStats ;
4209
4209
final List <DocIdSeqNoAndSource > prevDocs ;
4210
- final List <Translog .Operation > existingTranslog ;
4211
4210
try (InternalEngine engine = createEngine (store , createTempDir (), globalCheckpoint ::get )) {
4212
4211
engineConfig = engine .config ();
4213
4212
for (final long seqNo : seqNos ) {
@@ -4226,24 +4225,17 @@ public void testRestoreLocalHistoryFromTranslog() throws IOException {
4226
4225
engine .syncTranslog ();
4227
4226
prevSeqNoStats = engine .getSeqNoStats (globalCheckpoint .get ());
4228
4227
prevDocs = getDocIds (engine , true );
4229
- try (Translog .Snapshot snapshot = engine .getTranslog ().newSnapshot ()) {
4230
- existingTranslog = TestTranslog .drainSnapshot (snapshot , false );
4231
- }
4232
4228
}
4233
4229
try (InternalEngine engine = new InternalEngine (engineConfig )) {
4234
- final Translog .TranslogGeneration currrentTranslogGeneration = new Translog .TranslogGeneration (
4235
- engine .getTranslog ().getTranslogUUID (), engine .getTranslog ().currentFileGeneration ());
4230
+ final long currentTranslogGeneration = engine .getTranslog ().currentFileGeneration ();
4236
4231
engine .recoverFromTranslog (translogHandler , globalCheckpoint .get ());
4237
4232
engine .restoreLocalHistoryFromTranslog (translogHandler );
4238
4233
assertThat (getDocIds (engine , true ), equalTo (prevDocs ));
4239
4234
SeqNoStats seqNoStats = engine .getSeqNoStats (globalCheckpoint .get ());
4240
4235
assertThat (seqNoStats .getLocalCheckpoint (), equalTo (prevSeqNoStats .getLocalCheckpoint ()));
4241
4236
assertThat (seqNoStats .getMaxSeqNo (), equalTo (prevSeqNoStats .getMaxSeqNo ()));
4242
- try (Translog .Snapshot snapshot = engine .getTranslog ().newSnapshot ()) {
4243
- assertThat ("restore from local translog must not add operations to translog" ,
4244
- snapshot .totalOperations (), equalTo (existingTranslog .size ()));
4245
- assertThat (TestTranslog .drainSnapshot (snapshot , false ), equalTo (existingTranslog ));
4246
- }
4237
+ assertThat ("restore from local translog must not add operations to translog" ,
4238
+ engine .getTranslog ().totalOperationsByMinGen (currentTranslogGeneration ), equalTo (0 ));
4247
4239
}
4248
4240
assertConsistentHistoryBetweenTranslogAndLuceneIndex (engine , createMapperService ());
4249
4241
}
0 commit comments