Пример #1
0
        /// <summary>
        /// Performs construction of <seealso cref="StoreUpgrader"/> and all of the necessary participants and performs store
        /// migration if that is required. </summary>
        /// <param name="directoryStructure"> database to migrate </param>
        public virtual void Migrate(DatabaseLayout directoryStructure)
        {
            LogProvider        logProvider        = _logService.InternalLogProvider;
            UpgradableDatabase upgradableDatabase = new UpgradableDatabase(new StoreVersionCheck(_pageCache), _format, _tailScanner);
            StoreUpgrader      storeUpgrader      = new StoreUpgrader(upgradableDatabase, _progressMonitor, _config, _fs, _pageCache, logProvider);

            ExplicitIndexMigrator        explicitIndexMigrator        = new ExplicitIndexMigrator(_fs, _explicitIndexProvider, logProvider);
            StoreMigrator                storeMigrator                = new StoreMigrator(_fs, _pageCache, _config, _logService, _jobScheduler);
            NativeLabelScanStoreMigrator nativeLabelScanStoreMigrator = new NativeLabelScanStoreMigrator(_fs, _pageCache, _config);
            CountsMigrator               countsMigrator               = new CountsMigrator(_fs, _pageCache, _config);

            _indexProviderMap.accept(provider => storeUpgrader.addParticipant(provider.storeMigrationParticipant(_fs, _pageCache)));
            storeUpgrader.AddParticipant(explicitIndexMigrator);
            storeUpgrader.AddParticipant(storeMigrator);
            storeUpgrader.AddParticipant(nativeLabelScanStoreMigrator);
            storeUpgrader.AddParticipant(countsMigrator);
            storeUpgrader.MigrateIfNeeded(directoryStructure);
        }
Пример #2
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void migrateHighLimit3_0StoreFiles() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void MigrateHighLimit3_0StoreFiles()
        {
            FileSystemAbstraction fileSystem = _fileSystemRule.get();
            PageCache             pageCache  = _pageCacheRule.getPageCache(fileSystem);

            using (JobScheduler jobScheduler = new ThreadPoolJobScheduler())
            {
                StoreMigrator migrator = new StoreMigrator(fileSystem, pageCache, Config.defaults(), NullLogService.Instance, jobScheduler);

                DatabaseLayout databaseLayout  = _testDirectory.databaseLayout();
                DatabaseLayout migrationLayout = _testDirectory.databaseLayout("migration");

                PrepareNeoStoreFile(fileSystem, databaseLayout, HighLimitV3_0_0.STORE_VERSION, pageCache);

                ProgressReporter progressMonitor = mock(typeof(ProgressReporter));

                migrator.Migrate(databaseLayout, migrationLayout, progressMonitor, HighLimitV3_0_0.STORE_VERSION, HighLimit.StoreVersion);

                int newStoreFilesCount = fileSystem.ListFiles(migrationLayout.DatabaseDirectory()).Length;
                assertThat("Store should be migrated and new store files should be created.", newStoreFilesCount, Matchers.greaterThanOrEqualTo(StoreType.values().length));
            }
        }