Esempio n. 1
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldBeAbleToResumeMigrationOnRebuildingCounts() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void ShouldBeAbleToResumeMigrationOnRebuildingCounts()
        {
            // GIVEN a legacy database
            DatabaseLayout databaseLayout = _directory.databaseLayout();
            File           prepare        = _directory.directory("prepare");

            MigrationTestUtils.prepareSampleLegacyDatabase(Version, _fs, databaseLayout.DatabaseDirectory(), prepare);
            // and a state of the migration saying that it has done the actual migration
            LogService         logService         = NullLogService.Instance;
            PageCache          pageCache          = _pageCacheRule.getPageCache(_fs);
            LogTailScanner     tailScanner        = GetTailScanner(databaseLayout.DatabaseDirectory());
            UpgradableDatabase upgradableDatabase = GetUpgradableDatabase(pageCache, tailScanner);

            string versionToMigrateFrom = upgradableDatabase.CheckUpgradable(databaseLayout).storeVersion();
            SilentMigrationProgressMonitor progressMonitor = new SilentMigrationProgressMonitor();
            StoreMigrator  migrator        = new StoreMigrator(_fs, pageCache, _config, logService, _jobScheduler);
            DatabaseLayout migrationLayout = _directory.databaseLayout(StoreUpgrader.MIGRATION_DIRECTORY);

            migrator.Migrate(databaseLayout, migrationLayout, progressMonitor.StartSection("section"), versionToMigrateFrom, upgradableDatabase.CurrentVersion());

            // WHEN simulating resuming the migration
            progressMonitor = new SilentMigrationProgressMonitor();
            CountsMigrator countsMigrator = new CountsMigrator(_fs, pageCache, _config);

            countsMigrator.Migrate(databaseLayout, migrationLayout, progressMonitor.StartSection("section"), versionToMigrateFrom, upgradableDatabase.CurrentVersion());
            migrator.MoveMigratedFiles(migrationLayout, databaseLayout, versionToMigrateFrom, upgradableDatabase.CurrentVersion());
            countsMigrator.MoveMigratedFiles(migrationLayout, databaseLayout, versionToMigrateFrom, upgradableDatabase.CurrentVersion());

            // THEN starting the new store should be successful
            StoreFactory storeFactory = new StoreFactory(databaseLayout, _config, new DefaultIdGeneratorFactory(_fs), pageCache, _fs, logService.InternalLogProvider, EmptyVersionContextSupplier.EMPTY);

            storeFactory.OpenAllNeoStores().close();
        }
Esempio n. 2
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldBeAbleToMigrateWithoutErrors() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void ShouldBeAbleToMigrateWithoutErrors()
        {
            // GIVEN a legacy database
            DatabaseLayout databaseLayout = _directory.databaseLayout();
            File           prepare        = _directory.directory("prepare");

            MigrationTestUtils.prepareSampleLegacyDatabase(Version, _fs, databaseLayout.DatabaseDirectory(), prepare);

            AssertableLogProvider logProvider = new AssertableLogProvider(true);
            LogService            logService  = new SimpleLogService(logProvider, logProvider);
            PageCache             pageCache   = _pageCacheRule.getPageCache(_fs);

            LogTailScanner     tailScanner        = GetTailScanner(databaseLayout.DatabaseDirectory());
            UpgradableDatabase upgradableDatabase = GetUpgradableDatabase(pageCache, tailScanner);

            string versionToMigrateFrom = upgradableDatabase.CheckUpgradable(databaseLayout).storeVersion();
            SilentMigrationProgressMonitor progressMonitor = new SilentMigrationProgressMonitor();
            StoreMigrator  migrator        = new StoreMigrator(_fs, pageCache, _config, logService, _jobScheduler);
            CountsMigrator countsMigrator  = new CountsMigrator(_fs, pageCache, _config);
            DatabaseLayout migrationLayout = _directory.databaseLayout(StoreUpgrader.MIGRATION_DIRECTORY);

            // WHEN migrating
            migrator.Migrate(databaseLayout, migrationLayout, progressMonitor.StartSection("section"), versionToMigrateFrom, upgradableDatabase.CurrentVersion());
            countsMigrator.Migrate(databaseLayout, migrationLayout, progressMonitor.StartSection("section"), versionToMigrateFrom, upgradableDatabase.CurrentVersion());
            migrator.MoveMigratedFiles(migrationLayout, databaseLayout, versionToMigrateFrom, upgradableDatabase.CurrentVersion());
            countsMigrator.MoveMigratedFiles(migrationLayout, databaseLayout, versionToMigrateFrom, upgradableDatabase.CurrentVersion());

            // THEN starting the new store should be successful
            StoreFactory storeFactory = new StoreFactory(databaseLayout, _config, new DefaultIdGeneratorFactory(_fs), pageCache, _fs, logService.InternalLogProvider, EmptyVersionContextSupplier.EMPTY);

            storeFactory.OpenAllNeoStores().close();
            logProvider.RawMessageMatcher().assertNotContains("ERROR");
        }
Esempio n. 3
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldNotDoActualStoreMigrationBetween3_0_5_and_next() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void ShouldNotDoActualStoreMigrationBetween3_0_5AndNext()
        {
            // GIVEN a store in vE.H.0 format
            DatabaseLayout databaseLayout = _directory.databaseLayout();

            (new TestGraphDatabaseFactory()).newEmbeddedDatabaseBuilder(databaseLayout.DatabaseDirectory()).setConfig(GraphDatabaseSettings.record_format, HighLimitV3_0_0.NAME).newGraphDatabase().shutdown();
            Config config = Config.defaults(pagecache_memory, "8m");

            try (FileSystemAbstraction fs = new DefaultFileSystemAbstraction(); JobScheduler _jobScheduler = new ThreadPoolJobScheduler(); PageCache _pageCache = new ConfiguringPageCacheFactory(fs, config, NULL, Org.Neo4j.Io.pagecache.tracing.cursor.PageCursorTracerSupplier_Fields.Null, NullLog.Instance, EmptyVersionContextSupplier.EMPTY, _jobScheduler)
                                                                                                                                                                  .OrCreatePageCache)
                {
                    // For test code sanity
                    string fromStoreVersion = StoreVersion.HIGH_LIMIT_V3_0_0.versionString();
                    StoreVersionCheck.Result hasVersionResult = (new StoreVersionCheck(_pageCache)).hasVersion(databaseLayout.MetadataStore(), fromStoreVersion);
                    assertTrue(hasVersionResult.ActualVersion, hasVersionResult.Outcome.Successful);

                    // WHEN
                    StoreMigrator    migrator        = new StoreMigrator(fs, _pageCache, config, NullLogService.Instance, _jobScheduler);
                    ProgressReporter monitor         = mock(typeof(ProgressReporter));
                    DatabaseLayout   migrationLayout = _directory.databaseLayout("migration");
                    migrator.Migrate(_directory.databaseLayout(), migrationLayout, monitor, fromStoreVersion, StoreVersion.HIGH_LIMIT_V3_0_6.versionString());

                    // THEN
                    verifyNoMoreInteractions(monitor);
                }
        }
Esempio n. 4
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldNotMigrateFilesForVersionsWithSameCapability() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void ShouldNotMigrateFilesForVersionsWithSameCapability()
        {
            // Prepare migrator and file
            StoreMigrator  migrator = NewStoreMigrator();
            DatabaseLayout dbLayout = _directory.databaseLayout();
            File           neoStore = dbLayout.MetadataStore();

            neoStore.createNewFile();

            // Monitor what happens
            MyProgressReporter progressReporter = new MyProgressReporter();

            // Migrate with two storeversions that have the same FORMAT capabilities
            migrator.Migrate(dbLayout, _directory.databaseLayout("migrationDir"), progressReporter, StandardV3_0.STORE_VERSION, StandardV3_2.STORE_VERSION);

            // Should not have started any migration
            assertFalse(progressReporter.Started);
        }
Esempio n. 5
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldComputeTheLastTxInfoCorrectly() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void ShouldComputeTheLastTxInfoCorrectly()
        {
            // given
            DatabaseLayout databaseLayout = _directory.databaseLayout();
            File           prepare        = _directory.directory("prepare");

            MigrationTestUtils.prepareSampleLegacyDatabase(Version, _fs, databaseLayout.DatabaseDirectory(), prepare);
            // and a state of the migration saying that it has done the actual migration
            LogService         logService         = NullLogService.Instance;
            PageCache          pageCache          = _pageCacheRule.getPageCache(_fs);
            LogTailScanner     tailScanner        = GetTailScanner(databaseLayout.DatabaseDirectory());
            UpgradableDatabase upgradableDatabase = GetUpgradableDatabase(pageCache, tailScanner);

            string versionToMigrateFrom = upgradableDatabase.CheckUpgradable(databaseLayout).storeVersion();
            SilentMigrationProgressMonitor progressMonitor = new SilentMigrationProgressMonitor();
            StoreMigrator  migrator        = new StoreMigrator(_fs, pageCache, _config, logService, _jobScheduler);
            DatabaseLayout migrationLayout = _directory.databaseLayout(StoreUpgrader.MIGRATION_DIRECTORY);

            // when
            migrator.Migrate(databaseLayout, migrationLayout, progressMonitor.StartSection("section"), versionToMigrateFrom, upgradableDatabase.CurrentVersion());

            // then
            assertTrue(TxIdComparator.apply(migrator.ReadLastTxInformation(migrationLayout)));
        }