use of org.neo4j.kernel.impl.storemigration.StoreUpgrader in project neo4j by neo4j.
the class StoreMigratorFrom20IT method upgrader.
private StoreUpgrader upgrader(SchemaIndexMigrator indexMigrator, StoreMigrator storeMigrator) {
Config config = getConfig().augment(stringMap(GraphDatabaseSettings.allow_store_upgrade.name(), "true"));
StoreUpgrader upgrader = new StoreUpgrader(upgradableDatabase, monitor, config, fs, pageCache, NullLogProvider.getInstance());
upgrader.addParticipant(indexMigrator);
upgrader.addParticipant(storeMigrator);
return upgrader;
}
use of org.neo4j.kernel.impl.storemigration.StoreUpgrader in project neo4j by neo4j.
the class StoreUpgraderInterruptionTestIT method newUpgrader.
private StoreUpgrader newUpgrader(UpgradableDatabase upgradableDatabase, PageCache pageCache, MigrationProgressMonitor progressMonitor, SchemaIndexMigrator indexMigrator, StoreMigrator migrator) {
Config allowUpgrade = Config.embeddedDefaults(stringMap(GraphDatabaseSettings.allow_store_upgrade.name(), "true"));
StoreUpgrader upgrader = new StoreUpgrader(upgradableDatabase, progressMonitor, allowUpgrade, fs, pageCache, NullLogProvider.getInstance());
upgrader.addParticipant(indexMigrator);
upgrader.addParticipant(migrator);
return upgrader;
}
use of org.neo4j.kernel.impl.storemigration.StoreUpgrader in project neo4j by neo4j.
the class StoreUpgraderTest method newUpgrader.
private StoreUpgrader newUpgrader(UpgradableDatabase upgradableDatabase, PageCache pageCache, Config config) throws IOException {
check = new StoreVersionCheck(pageCache);
SilentMigrationProgressMonitor progressMonitor = new SilentMigrationProgressMonitor();
NullLogService instance = NullLogService.getInstance();
StoreMigrator defaultMigrator = new StoreMigrator(fileSystem, pageCache, getTuningConfig(), instance, schemaIndexProvider);
SchemaIndexMigrator indexMigrator = new SchemaIndexMigrator(fileSystem, schemaIndexProvider, labelScanStoreProvider);
StoreUpgrader upgrader = new StoreUpgrader(upgradableDatabase, progressMonitor, config, fileSystem, pageCache, NullLogProvider.getInstance());
upgrader.addParticipant(indexMigrator);
upgrader.addParticipant(defaultMigrator);
return upgrader;
}
use of org.neo4j.kernel.impl.storemigration.StoreUpgrader in project neo4j by neo4j.
the class StoreUpgraderTest method upgraderShouldCleanupLegacyLeftoverAndMigrationDirs.
@Test
public void upgraderShouldCleanupLegacyLeftoverAndMigrationDirs() throws Exception {
// Given
fileSystem.deleteFile(new File(dbDirectory, StoreLogService.INTERNAL_LOG_NAME));
fileSystem.mkdir(new File(dbDirectory, StoreUpgrader.MIGRATION_DIRECTORY));
fileSystem.mkdir(new File(dbDirectory, StoreUpgrader.MIGRATION_LEFT_OVERS_DIRECTORY));
fileSystem.mkdir(new File(dbDirectory, StoreUpgrader.MIGRATION_LEFT_OVERS_DIRECTORY + "_1"));
fileSystem.mkdir(new File(dbDirectory, StoreUpgrader.MIGRATION_LEFT_OVERS_DIRECTORY + "_2"));
fileSystem.mkdir(new File(dbDirectory, StoreUpgrader.MIGRATION_LEFT_OVERS_DIRECTORY + "_42"));
PageCache pageCache = pageCacheRule.getPageCache(fileSystem);
// When
UpgradableDatabase upgradableDatabase = new UpgradableDatabase(fileSystem, new StoreVersionCheck(pageCache), new LegacyStoreVersionCheck(fileSystem), getRecordFormats());
StoreUpgrader storeUpgrader = newUpgrader(upgradableDatabase, pageCache);
storeUpgrader.migrateIfNeeded(dbDirectory);
// Then
assertThat(migrationHelperDirs(), is(emptyCollectionOf(File.class)));
}
use of org.neo4j.kernel.impl.storemigration.StoreUpgrader in project neo4j by neo4j.
the class StoreUpgraderTest method shouldContinueMovingFilesIfUpgradeCancelledWhileMoving.
@Test
public void shouldContinueMovingFilesIfUpgradeCancelledWhileMoving() throws Exception {
PageCache pageCache = pageCacheRule.getPageCache(fileSystem);
UpgradableDatabase upgradableDatabase = new UpgradableDatabase(fileSystem, new StoreVersionCheck(pageCache), new LegacyStoreVersionCheck(fileSystem), getRecordFormats());
String versionToMigrateTo = upgradableDatabase.currentVersion();
String versionToMigrateFrom = upgradableDatabase.checkUpgradeable(dbDirectory).storeVersion();
// GIVEN
{
StoreUpgrader upgrader = newUpgrader(upgradableDatabase, allowMigrateConfig, pageCache);
String failureMessage = "Just failing";
upgrader.addParticipant(participantThatWillFailWhenMoving(failureMessage));
// WHEN
try {
upgrader.migrateIfNeeded(dbDirectory);
fail("should have thrown");
} catch (UnableToUpgradeException e) {
// THEN
assertTrue(e.getCause() instanceof IOException);
assertEquals(failureMessage, e.getCause().getMessage());
}
}
// AND WHEN
{
StoreUpgrader upgrader = newUpgrader(upgradableDatabase, pageCache);
StoreMigrationParticipant observingParticipant = Mockito.mock(StoreMigrationParticipant.class);
upgrader.addParticipant(observingParticipant);
upgrader.migrateIfNeeded(dbDirectory);
// THEN
verify(observingParticipant, Mockito.times(0)).migrate(any(File.class), any(File.class), any(MigrationProgressMonitor.Section.class), eq(versionToMigrateFrom), eq(versionToMigrateTo));
verify(observingParticipant, Mockito.times(1)).moveMigratedFiles(any(File.class), any(File.class), eq(versionToMigrateFrom), eq(versionToMigrateTo));
verify(observingParticipant, Mockito.times(1)).cleanup(any(File.class));
}
}
Aggregations