Exemplo n.º 1
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldSucceedWithUpgradeAfterPreviousAttemptDiedDuringMigration() throws java.io.IOException, org.neo4j.consistency.checking.full.ConsistencyCheckIncompleteException
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void ShouldSucceedWithUpgradeAfterPreviousAttemptDiedDuringMigration()
        {
            MigrationTestUtils.prepareSampleLegacyDatabase(Version, _fs, _workingDatabaseLayout.databaseDirectory(), _prepareDirectory);
            PageCache                      pageCache            = _pageCacheRule.getPageCache(_fs);
            StoreVersionCheck              check                = new StoreVersionCheck(pageCache);
            UpgradableDatabase             upgradableDatabase   = GetUpgradableDatabase(check);
            SilentMigrationProgressMonitor progressMonitor      = new SilentMigrationProgressMonitor();
            LogService                     logService           = NullLogService.Instance;
            StoreMigrator                  failingStoreMigrator = new StoreMigratorAnonymousInnerClass(this, _fs, pageCache, _config, logService, _jobScheduler);

            try
            {
                NewUpgrader(upgradableDatabase, pageCache, progressMonitor, CreateIndexMigrator(), failingStoreMigrator).migrateIfNeeded(_workingDatabaseLayout);
                fail("Should throw exception");
            }
            catch (Exception e)
            {
                assertEquals("This upgrade is failing", e.Message);
            }

            progressMonitor = new SilentMigrationProgressMonitor();
            StoreMigrator       migrator      = new StoreMigrator(_fs, pageCache, _config, logService, _jobScheduler);
            SchemaIndexMigrator indexMigrator = CreateIndexMigrator();

            NewUpgrader(upgradableDatabase, pageCache, progressMonitor, indexMigrator, migrator).migrateIfNeeded(_workingDatabaseLayout);

            assertTrue(checkNeoStoreHasDefaultFormatVersion(check, _workingDatabaseLayout));

            // Since consistency checker is in read only mode we need to start/stop db to generate label scan store.
            StartStopDatabase(_workingDatabaseLayout.databaseDirectory());
            assertConsistentStore(_workingDatabaseLayout);
        }
Exemplo n.º 2
0
        private StoreUpgrader NewUpgrader(UpgradableDatabase upgradableDatabase, PageCache pageCache, Config config, MigrationProgressMonitor progressMonitor)
        {
            NullLogService      instance        = NullLogService.Instance;
            StoreMigrator       defaultMigrator = new StoreMigrator(_fileSystem, pageCache, TuningConfig, instance, _jobScheduler);
            CountsMigrator      countsMigrator  = new CountsMigrator(_fileSystem, pageCache, TuningConfig);
            SchemaIndexMigrator indexMigrator   = new SchemaIndexMigrator(_fileSystem, IndexProvider.EMPTY);

            StoreUpgrader upgrader = new StoreUpgrader(upgradableDatabase, progressMonitor, config, _fileSystem, pageCache, NullLogProvider.Instance);

            upgrader.AddParticipant(indexMigrator);
            upgrader.AddParticipant(AbstractStoreMigrationParticipant.NOT_PARTICIPATING);
            upgrader.AddParticipant(AbstractStoreMigrationParticipant.NOT_PARTICIPATING);
            upgrader.AddParticipant(AbstractStoreMigrationParticipant.NOT_PARTICIPATING);
            upgrader.AddParticipant(AbstractStoreMigrationParticipant.NOT_PARTICIPATING);
            upgrader.AddParticipant(defaultMigrator);
            upgrader.AddParticipant(countsMigrator);
            return(upgrader);
        }
Exemplo n.º 3
0
        private StoreUpgrader NewUpgrader(UpgradableDatabase upgradableDatabase, PageCache pageCache, MigrationProgressMonitor progressMonitor, SchemaIndexMigrator indexMigrator, StoreMigrator migrator)
        {
            Config allowUpgrade = Config.defaults(GraphDatabaseSettings.allow_upgrade, "true");

            StoreUpgrader upgrader = new StoreUpgrader(upgradableDatabase, progressMonitor, allowUpgrade, _fs, pageCache, NullLogProvider.Instance);

            upgrader.AddParticipant(indexMigrator);
            upgrader.AddParticipant(migrator);
            return(upgrader);
        }