@Before public void setUp() throws Exception { databaseLayout = testDirectory.databaseLayout(); storeDir = databaseLayout.databaseDirectory(); nativeLabelIndex = databaseLayout.labelScanStore(); migrationLayout = testDirectory.databaseLayout( "migrationDir" ); luceneLabelScanStore = testDirectory.databaseDir().toPath().resolve( Paths.get( "schema", "label", "lucene" ) ).toFile(); fileSystem = fileSystemRule.get(); pageCache = pageCacheRule.getPageCache( fileSystemRule ); indexMigrator = new NativeLabelScanStoreMigrator( fileSystem, pageCache, Config.defaults() ); fileSystem.mkdirs( luceneLabelScanStore ); }
/** * Performs construction of {@link StoreUpgrader} and all of the necessary participants and performs store * migration if that is required. * @param directoryStructure database to migrate */ public void migrate( DatabaseLayout directoryStructure ) { LogProvider logProvider = logService.getInternalLogProvider(); UpgradableDatabase upgradableDatabase = new UpgradableDatabase( new StoreVersionCheck( pageCache ), format, tailScanner ); StoreUpgrader storeUpgrader = new StoreUpgrader( upgradableDatabase, progressMonitor, config, fs, pageCache, logProvider ); ExplicitIndexMigrator explicitIndexMigrator = new ExplicitIndexMigrator( fs, explicitIndexProvider, logProvider ); StoreMigrator storeMigrator = new StoreMigrator( fs, pageCache, config, logService, jobScheduler ); NativeLabelScanStoreMigrator nativeLabelScanStoreMigrator = new NativeLabelScanStoreMigrator( fs, pageCache, config ); CountsMigrator countsMigrator = new CountsMigrator( fs, pageCache, config ); indexProviderMap.accept( provider -> storeUpgrader.addParticipant( provider.storeMigrationParticipant( fs, pageCache ) ) ); storeUpgrader.addParticipant( explicitIndexMigrator ); storeUpgrader.addParticipant( storeMigrator ); storeUpgrader.addParticipant( nativeLabelScanStoreMigrator ); storeUpgrader.addParticipant( countsMigrator ); storeUpgrader.migrateIfNeeded( directoryStructure ); } }
/** * Performs construction of {@link StoreUpgrader} and all of the necessary participants and performs store * migration if that is required. * @param directoryStructure database to migrate */ public void migrate( DatabaseLayout directoryStructure ) { LogProvider logProvider = logService.getInternalLogProvider(); UpgradableDatabase upgradableDatabase = new UpgradableDatabase( new StoreVersionCheck( pageCache ), format, tailScanner ); StoreUpgrader storeUpgrader = new StoreUpgrader( upgradableDatabase, progressMonitor, config, fs, pageCache, logProvider ); ExplicitIndexMigrator explicitIndexMigrator = new ExplicitIndexMigrator( fs, explicitIndexProvider, logProvider ); StoreMigrator storeMigrator = new StoreMigrator( fs, pageCache, config, logService, jobScheduler ); NativeLabelScanStoreMigrator nativeLabelScanStoreMigrator = new NativeLabelScanStoreMigrator( fs, pageCache, config ); CountsMigrator countsMigrator = new CountsMigrator( fs, pageCache, config ); indexProviderMap.accept( provider -> storeUpgrader.addParticipant( provider.storeMigrationParticipant( fs, pageCache ) ) ); storeUpgrader.addParticipant( explicitIndexMigrator ); storeUpgrader.addParticipant( storeMigrator ); storeUpgrader.addParticipant( nativeLabelScanStoreMigrator ); storeUpgrader.addParticipant( countsMigrator ); storeUpgrader.migrateIfNeeded( directoryStructure ); } }