use of org.neo4j.storageengine.api.StoreVersionCheck in project neo4j by neo4j.
the class StoreUpgraderTest method upgradeShouldGiveProgressMonitorProgressMessages.
@ParameterizedTest
@MethodSource("versions")
void upgradeShouldGiveProgressMonitorProgressMessages(RecordFormats formats) throws Exception {
init(formats);
// Given
StoreVersionCheck check = getVersionCheck(pageCache);
// When
AssertableLogProvider logProvider = new AssertableLogProvider();
newUpgrader(check, pageCache, allowMigrateConfig, new VisibleMigrationProgressMonitor(logProvider.getLog("test"))).migrateIfNeeded(databaseLayout, false);
// Then
assertThat(logProvider).containsMessages("Store files", "Indexes", "Successfully finished");
}
use of org.neo4j.storageengine.api.StoreVersionCheck in project neo4j by neo4j.
the class StoreUpgraderTest method failToMoveTransactionLogsIfTheyAlreadyExist.
@ParameterizedTest
@MethodSource("versions")
void failToMoveTransactionLogsIfTheyAlreadyExist(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);
Path databaseTransactionLogsHome = txRoot.resolve(migrationLayout.getDatabaseName());
fileSystem.mkdir(databaseTransactionLogsHome);
createDummyTxLogFiles(databaseTransactionLogsHome);
assertThrows(StoreUpgrader.TransactionLogsRelocationException.class, () -> newUpgrader(check, pageCache, config, new VisibleMigrationProgressMonitor(logProvider.getLog("test"))).migrateIfNeeded(migrationLayout, false));
}
use of org.neo4j.storageengine.api.StoreVersionCheck 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.neo4j.storageengine.api.StoreVersionCheck 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.neo4j.storageengine.api.StoreVersionCheck 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));
}
Aggregations