use of org.junit.jupiter.params.provider.MethodSource in project neo4j by neo4j.
the class StoreUpgraderTest method shouldRefuseToUpgradeIfAnyOfTheStoresWereNotShutDownCleanly.
@ParameterizedTest
@MethodSource("versions")
void shouldRefuseToUpgradeIfAnyOfTheStoresWereNotShutDownCleanly(RecordFormats formats) throws IOException {
init(formats);
Path comparisonDirectory = testDirectory.directory("shouldRefuseToUpgradeIfAnyOfTheStoresWereNotShutDownCleanly-comparison");
removeCheckPointFromTxLog(fileSystem, databaseLayout.databaseDirectory());
fileSystem.deleteRecursively(comparisonDirectory);
fileSystem.copyRecursively(databaseLayout.databaseDirectory(), comparisonDirectory);
StoreVersionCheck check = getVersionCheck(pageCache);
assertThrows(StoreUpgrader.UnableToUpgradeException.class, () -> newUpgrader(check, pageCache).migrateIfNeeded(databaseLayout, false));
verifyFilesHaveSameContent(fileSystem, comparisonDirectory, databaseLayout.databaseDirectory());
}
use of org.junit.jupiter.params.provider.MethodSource in project neo4j by neo4j.
the class StoreUpgraderTest method tracePageCacheAccessOnStoreUpgrade.
@ParameterizedTest
@MethodSource("versions")
void tracePageCacheAccessOnStoreUpgrade(RecordFormats formats) throws IOException {
init(formats);
fileSystem.deleteFile(databaseLayout.file(INTERNAL_LOG_FILE));
StoreVersionCheck check = getVersionCheck(pageCache);
var pageCacheTracer = new DefaultPageCacheTracer();
newUpgrader(check, allowMigrateConfig, pageCache, pageCacheTracer).migrateIfNeeded(databaseLayout, false);
assertThat(pageCacheTracer.hits()).isGreaterThan(0);
assertThat(pageCacheTracer.pins()).isGreaterThan(0);
assertThat(pageCacheTracer.unpins()).isGreaterThan(0);
assertThat(pageCacheTracer.faults()).isGreaterThan(0);
StoreFactory factory = new StoreFactory(databaseLayout, allowMigrateConfig, new ScanOnOpenOverwritingIdGeneratorFactory(fileSystem, databaseLayout.getDatabaseName()), pageCache, fileSystem, NullLogProvider.getInstance(), NULL, writable());
try (NeoStores neoStores = factory.openAllNeoStores()) {
assertThat(neoStores.getMetaDataStore().getUpgradeTransaction()).isEqualTo(neoStores.getMetaDataStore().getLastCommittedTransaction());
assertThat(neoStores.getMetaDataStore().getUpgradeTime()).isPositive();
}
}
use of org.junit.jupiter.params.provider.MethodSource in project neo4j by neo4j.
the class StoreUpgraderTest method upgradeFailsIfMigrationIsNotAllowed.
@ParameterizedTest
@MethodSource("versions")
void upgradeFailsIfMigrationIsNotAllowed(RecordFormats formats) throws IOException {
init(formats);
StoreVersionCheck check = getVersionCheck(pageCache);
AssertableLogProvider logProvider = new AssertableLogProvider();
assertThrows(UpgradeNotAllowedException.class, () -> newUpgrader(check, pageCache, Config.defaults(), new VisibleMigrationProgressMonitor(logProvider.getLog("test"))).migrateIfNeeded(databaseLayout, false));
}
use of org.junit.jupiter.params.provider.MethodSource in project neo4j by neo4j.
the class StoreUpgraderTest method upgradeMoveTransactionLogs.
@ParameterizedTest
@MethodSource("versions")
void upgradeMoveTransactionLogs(RecordFormats formats) throws IOException {
init(formats);
Path txRoot = testDirectory.directory("customTxRoot");
AssertableLogProvider logProvider = new AssertableLogProvider();
StoreVersionCheck check = getVersionCheck(pageCache);
Config config = Config.newBuilder().fromConfig(allowMigrateConfig).set(neo4j_home, testDirectory.homePath()).set(GraphDatabaseSettings.transaction_logs_root_path, txRoot.toAbsolutePath()).set(default_database, databaseLayout.getDatabaseName()).build();
DatabaseLayout migrationLayout = DatabaseLayout.of(config);
newUpgrader(check, pageCache, config, new VisibleMigrationProgressMonitor(logProvider.getLog("test"))).migrateIfNeeded(migrationLayout, false);
assertThat(logProvider).containsMessages("Starting transaction logs migration.", "Transaction logs migration completed.");
assertThat(getLogFiles(migrationLayout.databaseDirectory())).isEmpty();
Path databaseTransactionLogsHome = txRoot.resolve(migrationLayout.getDatabaseName());
assertTrue(fileSystem.fileExists(databaseTransactionLogsHome));
Set<String> logFileNames = getLogFileNames(databaseTransactionLogsHome);
assertThat(logFileNames).isNotEmpty();
assertThat(logFileNames).containsAll(getLogFileNames(prepareDatabaseDirectory));
}
use of org.junit.jupiter.params.provider.MethodSource in project neo4j by neo4j.
the class StoreUpgraderTest method shouldRefuseToUpgradeIfAllOfTheStoresWereNotShutDownCleanly.
@ParameterizedTest
@MethodSource("versions")
void shouldRefuseToUpgradeIfAllOfTheStoresWereNotShutDownCleanly(RecordFormats formats) throws IOException {
init(formats);
Path comparisonDirectory = testDirectory.directory("shouldRefuseToUpgradeIfAllOfTheStoresWereNotShutDownCleanly-comparison");
removeCheckPointFromTxLog(fileSystem, databaseLayout.databaseDirectory());
fileSystem.deleteRecursively(comparisonDirectory);
fileSystem.copyRecursively(databaseLayout.databaseDirectory(), comparisonDirectory);
StoreVersionCheck check = getVersionCheck(pageCache);
assertThrows(StoreUpgrader.UnableToUpgradeException.class, () -> newUpgrader(check, pageCache).migrateIfNeeded(databaseLayout, false));
verifyFilesHaveSameContent(fileSystem, comparisonDirectory, databaseLayout.databaseDirectory());
}
Aggregations