Search in sources :

Example 16 with StoreType

use of org.neo4j.kernel.impl.store.StoreType 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);
        }
    }
}
Also used : StoreType(org.neo4j.kernel.impl.store.StoreType) ScanOnOpenReadOnlyIdGeneratorFactory(org.neo4j.internal.id.ScanOnOpenReadOnlyIdGeneratorFactory) NeoStores(org.neo4j.kernel.impl.store.NeoStores) DefaultIdGeneratorFactory(org.neo4j.internal.id.DefaultIdGeneratorFactory) CursorContext(org.neo4j.io.pagecache.context.CursorContext) StoreFactory(org.neo4j.kernel.impl.store.StoreFactory)

Example 17 with StoreType

use of org.neo4j.kernel.impl.store.StoreType in project neo4j by neo4j.

the class BatchingNeoStores method deleteStoreFiles.

private void deleteStoreFiles(DatabaseLayout databaseLayout, Predicate<StoreType> storesToKeep) {
    for (StoreType type : StoreType.values()) {
        if (!storesToKeep.test(type)) {
            DatabaseFile databaseFile = type.getDatabaseFile();
            databaseLayout.allFiles(databaseFile).forEach(uncheckedConsumer(fileSystem::deleteFile));
        }
    }
}
Also used : StoreType(org.neo4j.kernel.impl.store.StoreType) DatabaseFile(org.neo4j.io.layout.DatabaseFile)

Aggregations

StoreType (org.neo4j.kernel.impl.store.StoreType)17 NeoStores (org.neo4j.kernel.impl.store.NeoStores)5 ArrayList (java.util.ArrayList)4 PageCache (org.neo4j.io.pagecache.PageCache)4 File (java.io.File)3 Path (java.nio.file.Path)3 Test (org.junit.Test)3 DefaultIdGeneratorFactory (org.neo4j.internal.id.DefaultIdGeneratorFactory)3 ScanOnOpenReadOnlyIdGeneratorFactory (org.neo4j.internal.id.ScanOnOpenReadOnlyIdGeneratorFactory)3 CursorContext (org.neo4j.io.pagecache.context.CursorContext)3 StoreFactory (org.neo4j.kernel.impl.store.StoreFactory)3 StoreFileMetadata (org.neo4j.storageengine.api.StoreFileMetadata)3 IOException (java.io.IOException)2 ByteBuffer (java.nio.ByteBuffer)2 HashSet (java.util.HashSet)2 LongSupplier (java.util.function.LongSupplier)2 ImmutableSet (org.eclipse.collections.api.set.ImmutableSet)2 Config (org.neo4j.configuration.Config)2 DatabaseReadOnlyChecker (org.neo4j.configuration.helpers.DatabaseReadOnlyChecker)2 IdGeneratorFactory (org.neo4j.internal.id.IdGeneratorFactory)2