@Override public StoreMigrationParticipant storeMigrationParticipant( final FileSystemAbstraction fs, PageCache pageCache ) { return new SchemaIndexMigrator( fs, this ); }
@Override public void moveMigratedFiles( DatabaseLayout migrationLayout, DatabaseLayout directoryLayout, String versionToUpgradeFrom, String versionToMigrateTo ) throws IOException { if ( deleteObsoleteIndexes ) { deleteIndexes( schemaIndexDirectory ); } }
@Test public void schemaAndLabelIndexesRemovedAfterSuccessfulMigration() throws IOException { IndexDirectoryStructure directoryStructure = mock( IndexDirectoryStructure.class ); File indexProviderRootDirectory = databaseLayout.file( "just-some-directory" ); when( directoryStructure.rootDirectory() ).thenReturn( indexProviderRootDirectory ); when( indexProvider.directoryStructure() ).thenReturn( directoryStructure ); when( indexProvider.getProviderDescriptor() ) .thenReturn( new IndexProviderDescriptor( "key", "version" ) ); migrator.migrate( databaseLayout, migrationLayout, progressReporter, StandardV2_3.STORE_VERSION, StandardV3_0.STORE_VERSION ); migrator.moveMigratedFiles( migrationLayout, databaseLayout, StandardV2_3.STORE_VERSION, StandardV3_0.STORE_VERSION ); verify( fs ).deleteRecursively( indexProviderRootDirectory ); } }
@Override public StoreMigrationParticipant storeMigrationParticipant( final FileSystemAbstraction fs, PageCache pageCache ) { return new SchemaIndexMigrator( fs, this ); }
@Override public void moveMigratedFiles( DatabaseLayout migrationLayout, DatabaseLayout directoryLayout, String versionToUpgradeFrom, String versionToMigrateTo ) throws IOException { if ( deleteObsoleteIndexes ) { deleteIndexes( schemaIndexDirectory ); } }
private SchemaIndexMigrator createIndexMigrator() { return new SchemaIndexMigrator( fs, IndexProvider.EMPTY ); }
private StoreUpgrader newUpgrader( UpgradableDatabase upgradableDatabase, PageCache pageCache, Config config, MigrationProgressMonitor progressMonitor ) { NullLogService instance = NullLogService.getInstance(); StoreMigrator defaultMigrator = new StoreMigrator( fileSystem, pageCache, getTuningConfig(), instance, jobScheduler ); CountsMigrator countsMigrator = new CountsMigrator( fileSystem, pageCache, getTuningConfig() ); SchemaIndexMigrator indexMigrator = new SchemaIndexMigrator( fileSystem, IndexProvider.EMPTY ); StoreUpgrader upgrader = new StoreUpgrader( upgradableDatabase, progressMonitor, config, fileSystem, pageCache, NullLogProvider.getInstance() ); upgrader.addParticipant( indexMigrator ); upgrader.addParticipant( AbstractStoreMigrationParticipant.NOT_PARTICIPATING ); upgrader.addParticipant( AbstractStoreMigrationParticipant.NOT_PARTICIPATING ); upgrader.addParticipant( AbstractStoreMigrationParticipant.NOT_PARTICIPATING ); upgrader.addParticipant( AbstractStoreMigrationParticipant.NOT_PARTICIPATING ); upgrader.addParticipant( defaultMigrator ); upgrader.addParticipant( countsMigrator ); return upgrader; }