use of org.neo4j.kernel.impl.store.StoreFactory in project neo4j by neo4j.
the class RecordStorageMigratorIT method shouldBeAbleToResumeMigrationOnRebuildingCounts.
@ParameterizedTest
@MethodSource("versions")
void shouldBeAbleToResumeMigrationOnRebuildingCounts(String version, LogPosition expectedLogPosition, Function<TransactionId, Boolean> txIdComparator) throws Exception {
// GIVEN a legacy database
Path prepare = testDirectory.directory("prepare");
var fs = testDirectory.getFileSystem();
MigrationTestUtils.prepareSampleLegacyDatabase(version, fs, databaseLayout.databaseDirectory(), prepare);
// and a state of the migration saying that it has done the actual migration
LogService logService = NullLogService.getInstance();
RecordStoreVersionCheck check = getVersionCheck(pageCache, databaseLayout);
String versionToMigrateFrom = getVersionToMigrateFrom(check);
MigrationProgressMonitor progressMonitor = SILENT;
RecordStorageMigrator migrator = new RecordStorageMigrator(fs, pageCache, CONFIG, logService, jobScheduler, PageCacheTracer.NULL, batchImporterFactory, INSTANCE);
migrator.migrate(databaseLayout, migrationLayout, progressMonitor.startSection("section"), versionToMigrateFrom, getVersionToMigrateTo(check), EMPTY);
// WHEN simulating resuming the migration
migrator.moveMigratedFiles(migrationLayout, databaseLayout, versionToMigrateFrom, getVersionToMigrateTo(check));
// THEN starting the new store should be successful
StoreFactory storeFactory = new StoreFactory(databaseLayout, CONFIG, new ScanOnOpenOverwritingIdGeneratorFactory(fs, databaseLayout.getDatabaseName()), pageCache, fs, logService.getInternalLogProvider(), PageCacheTracer.NULL, writable());
storeFactory.openAllNeoStores().close();
}
use of org.neo4j.kernel.impl.store.StoreFactory in project neo4j by neo4j.
the class RecordStorageMigratorIT method shouldStartCheckpointLogVersionFromZeroIfMissingBeforeMigration.
@ParameterizedTest
@MethodSource("versions")
void shouldStartCheckpointLogVersionFromZeroIfMissingBeforeMigration(String version, LogPosition expectedLogPosition, Function<TransactionId, Boolean> txIdComparator) throws Exception {
// given
Path prepare = testDirectory.directory("prepare");
var fs = testDirectory.getFileSystem();
MigrationTestUtils.prepareSampleLegacyDatabase(version, fs, databaseLayout.databaseDirectory(), prepare);
RecordStoreVersionCheck check = getVersionCheck(pageCache, databaseLayout);
String versionToMigrateFrom = getVersionToMigrateFrom(check);
String versionToMigrateTo = getVersionToMigrateTo(check);
// when
RecordStorageMigrator migrator = new RecordStorageMigrator(fs, pageCache, CONFIG, NullLogService.getInstance(), jobScheduler, PageCacheTracer.NULL, batchImporterFactory, INSTANCE);
// when
migrator.migrate(databaseLayout, migrationLayout, SILENT.startSection("section"), versionToMigrateFrom, versionToMigrateTo, EMPTY);
migrator.moveMigratedFiles(migrationLayout, databaseLayout, versionToMigrateFrom, versionToMigrateTo);
// then
try (NeoStores neoStores = new StoreFactory(databaseLayout, Config.defaults(), new DefaultIdGeneratorFactory(fs, immediate(), databaseLayout.getDatabaseName()), pageCache, fs, nullLogProvider(), PageCacheTracer.NULL, writable()).openNeoStores(StoreType.META_DATA)) {
neoStores.start(NULL);
assertThat(neoStores.getMetaDataStore().getCheckpointLogVersion()).isEqualTo(0);
}
}
use of org.neo4j.kernel.impl.store.StoreFactory in project neo4j by neo4j.
the class RecordStorageMigratorIT method shouldBeAbleToResumeMigrationOnMoving.
@ParameterizedTest
@MethodSource("versions")
void shouldBeAbleToResumeMigrationOnMoving(String version, LogPosition expectedLogPosition, Function<TransactionId, Boolean> txIdComparator) throws Exception {
// GIVEN a legacy database
Path prepare = testDirectory.directory("prepare");
var fs = testDirectory.getFileSystem();
MigrationTestUtils.prepareSampleLegacyDatabase(version, fs, databaseLayout.databaseDirectory(), prepare);
// and a state of the migration saying that it has done the actual migration
LogService logService = NullLogService.getInstance();
RecordStoreVersionCheck check = getVersionCheck(pageCache, databaseLayout);
String versionToMigrateFrom = getVersionToMigrateFrom(check);
MigrationProgressMonitor progressMonitor = SILENT;
RecordStorageMigrator migrator = new RecordStorageMigrator(fs, pageCache, CONFIG, logService, jobScheduler, PageCacheTracer.NULL, batchImporterFactory, INSTANCE);
migrator.migrate(databaseLayout, migrationLayout, progressMonitor.startSection("section"), versionToMigrateFrom, getVersionToMigrateTo(check), EMPTY);
// WHEN simulating resuming the migration
migrator = new RecordStorageMigrator(fs, pageCache, CONFIG, logService, jobScheduler, PageCacheTracer.NULL, batchImporterFactory, INSTANCE);
migrator.moveMigratedFiles(migrationLayout, databaseLayout, versionToMigrateFrom, getVersionToMigrateTo(check));
// THEN starting the new store should be successful
StoreFactory storeFactory = new StoreFactory(databaseLayout, CONFIG, new ScanOnOpenOverwritingIdGeneratorFactory(fs, databaseLayout.getDatabaseName()), pageCache, fs, logService.getInternalLogProvider(), PageCacheTracer.NULL, writable());
storeFactory.openAllNeoStores().close();
}
use of org.neo4j.kernel.impl.store.StoreFactory in project neo4j by neo4j.
the class TransactionRecordStateTest method createStores.
private NeoStores createStores(Config config, RecordFormats formats) {
idGeneratorFactory = new DefaultIdGeneratorFactory(fs, immediate(), databaseLayout.getDatabaseName());
var storeFactory = new StoreFactory(databaseLayout, config, idGeneratorFactory, pageCache, fs, formats, NullLogProvider.getInstance(), PageCacheTracer.NULL, writable(), immutable.empty());
return storeFactory.openAllNeoStores(true);
}
use of org.neo4j.kernel.impl.store.StoreFactory in project neo4j by neo4j.
the class SchemaStorageTest method before.
@BeforeEach
void before() {
var storeFactory = new StoreFactory(databaseLayout, Config.defaults(), new DefaultIdGeneratorFactory(fs, immediate(), databaseLayout.getDatabaseName()), pageCache, fs, NullLogProvider.getInstance(), PageCacheTracer.NULL, writable());
neoStores = storeFactory.openNeoStores(true, StoreType.SCHEMA, StoreType.PROPERTY_KEY_TOKEN, StoreType.LABEL_TOKEN, StoreType.RELATIONSHIP_TYPE_TOKEN);
storage = new SchemaStorage(neoStores.getSchemaStore(), StoreTokens.readOnlyTokenHolders(neoStores, NULL), () -> KernelVersion.LATEST);
}
Aggregations