private void flushIdFiles( NeoStores neoStores, StoreType[] storeTypes ) { for ( StoreType type : storeTypes ) { if ( type.isRecordStore() ) { RecordStore<AbstractBaseRecord> recordStore = neoStores.getRecordStore( type ); Optional<File> idFile = databaseLayout.idFile( type.getDatabaseFile() ); idFile.ifPresent( f -> idGeneratorFactory.create( f, recordStore.getHighId(), false ) ); } } } }
@Override public Collection<StoreFileMetadata> listStorageFiles() { List<StoreFileMetadata> files = new ArrayList<>(); for ( StoreType type : StoreType.values() ) { if ( type.equals( StoreType.COUNTS ) ) { addCountStoreFiles( files ); } else { final RecordStore<AbstractBaseRecord> recordStore = neoStores.getRecordStore( type ); StoreFileMetadata metadata = new StoreFileMetadata( recordStore.getStorageFile(), recordStore.getRecordSize() ); files.add( metadata ); } } return files; }
public RenewableBatchIdSequences( NeoStores stores, int batchSize ) { for ( StoreType type : StoreType.values() ) { if ( type.isRecordStore() ) { RecordStore<AbstractBaseRecord> store = stores.getRecordStore( type ); if ( type.isLimitedIdStore() || batchSize == 1 ) { // This is a token store or otherwise meta-data store, so let's not add batching for it types[type.ordinal()] = store; } else { // This is a normal record store where id batching is beneficial types[type.ordinal()] = new RenewableBatchIdSequence( store, batchSize, store::freeId ); } } } }
public void migrate( DatabaseLayout fromDirectoryStructure, RecordFormats fromFormat, DatabaseLayout toDirectoryStructure, RecordFormats toFormat, ProgressReporter progressReporter, StoreType[] types, StoreType... additionalTypesToOpen ) { StoreType[] storesToOpen = ArrayUtil.concat( types, additionalTypesToOpen ); progressReporter.start( storesToOpen.length ); try ( NeoStores fromStores = new StoreFactory( fromDirectoryStructure, config, new DefaultIdGeneratorFactory( fs ), pageCache, fs, fromFormat, NullLogProvider.getInstance(), EmptyVersionContextSupplier.EMPTY ) .openNeoStores( true, storesToOpen ); NeoStores toStores = new StoreFactory( toDirectoryStructure, withPersistedStoreHeadersAsConfigFrom( fromStores, storesToOpen ), new DefaultIdGeneratorFactory( fs ), pageCache, fs, toFormat, NullLogProvider.getInstance(), EmptyVersionContextSupplier.EMPTY ) .openNeoStores( true, storesToOpen ) ) { for ( StoreType type : types ) { // This condition will exclude counts store first and foremost. if ( type.isRecordStore() ) { migrate( fromStores.getRecordStore( type ), toStores.getRecordStore( type ) ); progressReporter.progress( 1 ); } } } }
for ( StoreType type : relevantRecordStores() ) createRecordIn( stores.getNeoStores().getRecordStore( type ) ); RecordStore<AbstractBaseRecord> store = stores.getNeoStores().getRecordStore( type ); if ( type == typeToTest )
private static void assertSameStoreContents( EphemeralFileSystemAbstraction fs1, EphemeralFileSystemAbstraction fs2, DatabaseLayout databaseLayout ) { NullLogProvider logProvider = NullLogProvider.getInstance(); VersionContextSupplier contextSupplier = EmptyVersionContextSupplier.EMPTY; try ( ThreadPoolJobScheduler jobScheduler = new ThreadPoolJobScheduler(); PageCache pageCache1 = new ConfiguringPageCacheFactory( fs1, defaults(), PageCacheTracer.NULL, PageCursorTracerSupplier.NULL, NullLog.getInstance(), contextSupplier, jobScheduler ) .getOrCreatePageCache(); PageCache pageCache2 = new ConfiguringPageCacheFactory( fs2, defaults(), PageCacheTracer.NULL, PageCursorTracerSupplier.NULL, NullLog.getInstance(), contextSupplier, jobScheduler ) .getOrCreatePageCache(); NeoStores store1 = new StoreFactory( databaseLayout, defaults(), new DefaultIdGeneratorFactory( fs1 ), pageCache1, fs1, logProvider, contextSupplier ).openAllNeoStores(); NeoStores store2 = new StoreFactory( databaseLayout, defaults(), new DefaultIdGeneratorFactory( fs2 ), pageCache2, fs2, logProvider, contextSupplier ).openAllNeoStores() ) { for ( StoreType storeType : StoreType.values() ) { if ( storeType.isRecordStore() ) { assertSameStoreContents( store1.getRecordStore( storeType ), store2.getRecordStore( storeType ) ); } } } }
private void flushIdFiles( NeoStores neoStores, StoreType[] storeTypes ) { for ( StoreType type : storeTypes ) { if ( type.isRecordStore() ) { RecordStore<AbstractBaseRecord> recordStore = neoStores.getRecordStore( type ); Optional<File> idFile = databaseLayout.idFile( type.getDatabaseFile() ); idFile.ifPresent( f -> idGeneratorFactory.create( f, recordStore.getHighId(), false ) ); } } } }
@Override public Collection<StoreFileMetadata> listStorageFiles() { List<StoreFileMetadata> files = new ArrayList<>(); for ( StoreType type : StoreType.values() ) { if ( type.equals( StoreType.COUNTS ) ) { addCountStoreFiles( files ); } else { final RecordStore<AbstractBaseRecord> recordStore = neoStores.getRecordStore( type ); StoreFileMetadata metadata = new StoreFileMetadata( recordStore.getStorageFile(), recordStore.getRecordSize() ); files.add( metadata ); } } return files; }
public RenewableBatchIdSequences( NeoStores stores, int batchSize ) { for ( StoreType type : StoreType.values() ) { if ( type.isRecordStore() ) { RecordStore<AbstractBaseRecord> store = stores.getRecordStore( type ); if ( type.isLimitedIdStore() || batchSize == 1 ) { // This is a token store or otherwise meta-data store, so let's not add batching for it types[type.ordinal()] = store; } else { // This is a normal record store where id batching is beneficial types[type.ordinal()] = new RenewableBatchIdSequence( store, batchSize, store::freeId ); } } } }
public void migrate( DatabaseLayout fromDirectoryStructure, RecordFormats fromFormat, DatabaseLayout toDirectoryStructure, RecordFormats toFormat, ProgressReporter progressReporter, StoreType[] types, StoreType... additionalTypesToOpen ) { StoreType[] storesToOpen = ArrayUtil.concat( types, additionalTypesToOpen ); progressReporter.start( storesToOpen.length ); try ( NeoStores fromStores = new StoreFactory( fromDirectoryStructure, config, new DefaultIdGeneratorFactory( fs ), pageCache, fs, fromFormat, NullLogProvider.getInstance(), EmptyVersionContextSupplier.EMPTY ) .openNeoStores( true, storesToOpen ); NeoStores toStores = new StoreFactory( toDirectoryStructure, withPersistedStoreHeadersAsConfigFrom( fromStores, storesToOpen ), new DefaultIdGeneratorFactory( fs ), pageCache, fs, toFormat, NullLogProvider.getInstance(), EmptyVersionContextSupplier.EMPTY ) .openNeoStores( true, storesToOpen ) ) { for ( StoreType type : types ) { // This condition will exclude counts store first and foremost. if ( type.isRecordStore() ) { migrate( fromStores.getRecordStore( type ), toStores.getRecordStore( type ) ); progressReporter.progress( 1 ); } } } }