public RenewableBatchIdSequences(NeoStores stores, int batchSize)
 {
     foreach (StoreType type in StoreType.values())
     {
         if (type.RecordStore)
         {
             RecordStore <AbstractBaseRecord> store = stores.GetRecordStore(type);
             if (type.LimitedIdStore || 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);
             }
         }
     }
 }
Example #2
0
        public virtual void Migrate(DatabaseLayout fromDirectoryStructure, RecordFormats fromFormat, DatabaseLayout toDirectoryStructure, RecordFormats toFormat, ProgressReporter progressReporter, StoreType[] types, params 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.Instance, EmptyVersionContextSupplier.EMPTY)
                                        .openNeoStores(true, storesToOpen);
                 NeoStores toStores = (new StoreFactory(toDirectoryStructure, WithPersistedStoreHeadersAsConfigFrom(fromStores, storesToOpen), new DefaultIdGeneratorFactory(_fs), _pageCache, _fs, toFormat, NullLogProvider.Instance, EmptyVersionContextSupplier.EMPTY)).openNeoStores(true, storesToOpen))
                {
                    foreach (StoreType type in types)
                    {
                        // This condition will exclude counts store first and foremost.
                        if (type.RecordStore)
                        {
                            Migrate(fromStores.getRecordStore(type), toStores.GetRecordStore(type));
                            progressReporter.Progress(1);
                        }
                    }
                }
        }