use of org.neo4j.internal.id.ScanOnOpenReadOnlyIdGeneratorFactory in project neo4j by neo4j.
the class RecordStorageEngineFactory method transactionMetaDataStore.
@Override
public MetadataProvider transactionMetaDataStore(FileSystemAbstraction fs, DatabaseLayout databaseLayout, Config config, PageCache pageCache, PageCacheTracer cacheTracer) {
RecordFormats recordFormats = selectForStoreOrConfig(Config.defaults(), databaseLayout, fs, pageCache, NullLogProvider.getInstance(), cacheTracer);
var readOnlyChecker = new DatabaseReadOnlyChecker.Default(new DbmsReadOnlyChecker.Default(config), databaseLayout.getDatabaseName());
var idGeneratorFactory = readOnlyChecker.isReadOnly() ? new ScanOnOpenReadOnlyIdGeneratorFactory() : new DefaultIdGeneratorFactory(fs, immediate(), databaseLayout.getDatabaseName());
return new StoreFactory(databaseLayout, config, idGeneratorFactory, pageCache, fs, recordFormats, NullLogProvider.getInstance(), cacheTracer, readOnlyChecker, immutable.empty()).openNeoStores(META_DATA).getMetaDataStore();
}
use of org.neo4j.internal.id.ScanOnOpenReadOnlyIdGeneratorFactory in project neo4j by neo4j.
the class IdGeneratorMigrator method createEmptyPlaceHolderStoreFiles.
private Set<Path> createEmptyPlaceHolderStoreFiles(DatabaseLayout layout, RecordFormats format) {
Set<Path> createdStores = new HashSet<>();
StoreType[] storesToCreate = Stream.of(StoreType.values()).filter(t -> {
Path file = layout.file(t.getDatabaseFile());
boolean exists = fileSystem.fileExists(file);
if (!exists) {
createdStores.add(file);
}
return !exists;
}).toArray(StoreType[]::new);
createStoreFactory(layout, format, new ScanOnOpenReadOnlyIdGeneratorFactory()).openNeoStores(true, storesToCreate).close();
return createdStores;
}
use of org.neo4j.internal.id.ScanOnOpenReadOnlyIdGeneratorFactory in project neo4j by neo4j.
the class DirectRecordStoreMigrator method migrate.
public void migrate(DatabaseLayout fromDirectoryStructure, RecordFormats fromFormat, DatabaseLayout toDirectoryStructure, RecordFormats toFormat, ProgressReporter progressReporter, StoreType[] types, StoreType... additionalTypesToOpen) throws IOException {
StoreType[] storesToOpen = ArrayUtil.concat(types, additionalTypesToOpen);
progressReporter.start(storesToOpen.length);
try (NeoStores fromStores = new StoreFactory(fromDirectoryStructure, config, new ScanOnOpenReadOnlyIdGeneratorFactory(), pageCache, fs, fromFormat, NullLogProvider.getInstance(), cacheTracer, readOnly(), immutable.empty()).openNeoStores(true, storesToOpen);
NeoStores toStores = new StoreFactory(toDirectoryStructure, withPersistedStoreHeadersAsConfigFrom(fromStores, storesToOpen), new DefaultIdGeneratorFactory(fs, immediate(), toDirectoryStructure.getDatabaseName()), pageCache, fs, toFormat, NullLogProvider.getInstance(), cacheTracer, writable(), immutable.empty()).openNeoStores(true, storesToOpen);
var cursorContext = new CursorContext(cacheTracer.createPageCursorTracer(DIRECT_STORE_MIGRATOR_TAG))) {
toStores.start(cursorContext);
for (StoreType type : types) {
// This condition will exclude counts store first and foremost.
migrate(fromStores.getRecordStore(type), toStores.getRecordStore(type), cursorContext);
progressReporter.progress(1);
}
}
}
Aggregations