@Test
public void concurrentLuceneIndexSnapshotUseDifferentSnapshots() throws Exception
{
Label label = Label.label( "testLabel" );
database.withSetting( GraphDatabaseSettings.default_schema_provider, GraphDatabaseSettings.SchemaIndex.NATIVE20.providerName() );
prepareDatabase( label );
forceCheckpoint( checkPointer );
ResourceIterator<File> firstCheckpointSnapshot = indexingService.snapshotIndexFiles();
generateData( label );
removeOldNodes( LongStream.range( 1, 20 ) );
updateOldNodes( LongStream.range( 30, 40 ) );
forceCheckpoint( checkPointer );
ResourceIterator<File> secondCheckpointSnapshot = indexingService.snapshotIndexFiles();
generateData( label );
removeOldNodes( LongStream.range( 50, 60 ) );
updateOldNodes( LongStream.range( 70, 80 ) );
forceCheckpoint( checkPointer );
ResourceIterator<File> thirdCheckpointSnapshot = indexingService.snapshotIndexFiles();
Set<String> firstSnapshotFileNames = getFileNames( firstCheckpointSnapshot );
Set<String> secondSnapshotFileNames = getFileNames( secondCheckpointSnapshot );
Set<String> thirdSnapshotFileNames = getFileNames( thirdCheckpointSnapshot );
compareSnapshotFiles( firstSnapshotFileNames, secondSnapshotFileNames, fileSystem );
compareSnapshotFiles( secondSnapshotFileNames, thirdSnapshotFileNames, fileSystem);
compareSnapshotFiles( thirdSnapshotFileNames, firstSnapshotFileNames, fileSystem);
firstCheckpointSnapshot.close();
secondCheckpointSnapshot.close();
thirdCheckpointSnapshot.close();
}