Exemple #1
0
        internal BackupStrategyCoordinatorFactory(BackupModule backupModule)
        {
            this._logProvider  = backupModule.LogProvider;
            this._outsideWorld = backupModule.OutsideWorld;

            this._consistencyCheckService = new ConsistencyCheckService();
            this._addressResolver         = new AddressResolver();
        }
Exemple #2
0
 internal BackupStrategyCoordinator(ConsistencyCheckService consistencyCheckService, OutsideWorld outsideWorld, LogProvider logProvider, ProgressMonitorFactory progressMonitorFactory, IList <BackupStrategyWrapper> strategies)
 {
     this._consistencyCheckService = consistencyCheckService;
     this._outsideWorld            = outsideWorld;
     this._logProvider             = logProvider;
     this._progressMonitorFactory  = progressMonitorFactory;
     this._strategies = strategies;
 }
Exemple #3
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: private org.neo4j.consistency.ConsistencyCheckService.Result checkConsistency() throws org.neo4j.consistency.checking.full.ConsistencyCheckIncompleteException
        private ConsistencyCheckService.Result CheckConsistency()
        {
            Config config = Config.defaults();
            ConsistencyCheckService consistencyCheckService = new ConsistencyCheckService(DateTime.Now);
            ConsistencyFlags        checkConsistencyConfig  = new ConsistencyFlags(config);

            return(consistencyCheckService.runFullConsistencyCheck(_testDirectory.databaseLayout(), config, ProgressMonitorFactory.NONE, NullLogProvider.Instance, true, checkConsistencyConfig));
        }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: private org.neo4j.consistency.ConsistencyCheckService.Result fullConsistencyCheck() throws org.neo4j.consistency.checking.full.ConsistencyCheckIncompleteException, java.io.IOException
        private ConsistencyCheckService.Result FullConsistencyCheck()
        {
            using (FileSystemAbstraction fsa = new DefaultFileSystemAbstraction())
            {
                ConsistencyCheckService service = new ConsistencyCheckService();
                Config config = Config.defaults();
                return(service.runFullConsistencyCheck(Db.databaseLayout(), config, NONE, _log, fsa, true, new ConsistencyFlags(config)));
            }
        }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: private void runTest(int nodeCount, int run, boolean multiThreaded) throws Exception
        private void RunTest(int nodeCount, int run, bool multiThreaded)
        {
            // WHEN creating the indexes under stressful updates
            PopulateDbAndIndexes(nodeCount, multiThreaded);
            ConsistencyCheckService cc = new ConsistencyCheckService();

            ConsistencyCheckService.Result result = cc.RunFullConsistencyCheck(_directory.databaseLayout(), Config.defaults(GraphDatabaseSettings.pagecache_memory, "8m"), NONE, NullLogProvider.Instance, false);
            assertTrue(result.Successful);
            DropIndexes();
        }
Exemple #6
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: protected static org.neo4j.consistency.ConsistencyCheckService.Result runConsistencyChecker(org.neo4j.io.layout.DatabaseLayout databaseLayout, org.neo4j.io.fs.FileSystemAbstraction fs, org.neo4j.consistency.ConsistencyCheckService consistencyCheckService, String storeVersion) throws org.neo4j.consistency.checking.full.ConsistencyCheckIncompleteException
        protected internal static ConsistencyCheckService.Result RunConsistencyChecker(DatabaseLayout databaseLayout, FileSystemAbstraction fs, ConsistencyCheckService consistencyCheckService, string storeVersion)
        {
            Config config = Config.defaults(GraphDatabaseSettings.record_format, storeVersion);

            return(consistencyCheckService.runFullConsistencyCheck(databaseLayout, config, ProgressMonitorFactory.NONE, NullLogProvider.Instance, fs, false));
        }
Exemple #7
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldMigrate() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void ShouldMigrate()
        {
            DatabaseLayout       databaseLayout = _testDir.databaseLayout(BaseDirName(To, From));
            GraphDatabaseService database       = GetGraphDatabaseService(databaseLayout.DatabaseDirectory(), From.storeVersion());

            database.Execute("CREATE INDEX ON :Person(name)");
            database.Execute("CREATE INDEX ON :Person(born)");
            database.Execute("CREATE CONSTRAINT ON (person:Person) ASSERT exists(person.name)");
            database.Execute(CreateQuery);
            long beforeNodes;
            long beforeLabels;
            long beforeKeys;
            long beforeRels;
            long beforeRelTypes;
            long beforeIndexes;
            long beforeConstraints;

            using (Transaction ignore = database.BeginTx())
            {
                beforeNodes       = database.AllNodes.Count();
                beforeLabels      = database.AllLabels.Count();
                beforeKeys        = database.AllPropertyKeys.Count();
                beforeRels        = database.AllRelationships.Count();
                beforeRelTypes    = database.AllRelationshipTypes.Count();
                beforeIndexes     = Stream(database.Schema().Indexes).count();
                beforeConstraints = Stream(database.Schema().Constraints).count();
            }
            database.Shutdown();

            database = GetGraphDatabaseService(databaseLayout.DatabaseDirectory(), To.storeVersion());
            long afterNodes;
            long afterLabels;
            long afterKeys;
            long afterRels;
            long afterRelTypes;
            long afterIndexes;
            long afterConstraints;

            using (Transaction ignore = database.BeginTx())
            {
                afterNodes       = database.AllNodes.Count();
                afterLabels      = database.AllLabels.Count();
                afterKeys        = database.AllPropertyKeys.Count();
                afterRels        = database.AllRelationships.Count();
                afterRelTypes    = database.AllRelationshipTypes.Count();
                afterIndexes     = Stream(database.Schema().Indexes).count();
                afterConstraints = Stream(database.Schema().Constraints).count();
            }
            database.Shutdown();

            assertEquals(beforeNodes, afterNodes);               //171
            assertEquals(beforeLabels, afterLabels);             //2
            assertEquals(beforeKeys, afterKeys);                 //8
            assertEquals(beforeRels, afterRels);                 //253
            assertEquals(beforeRelTypes, afterRelTypes);         //6
            assertEquals(beforeIndexes, afterIndexes);           //2
            assertEquals(beforeConstraints, afterConstraints);   //1
            ConsistencyCheckService consistencyCheckService = new ConsistencyCheckService();

            ConsistencyCheckService.Result result = RunConsistencyChecker(databaseLayout, _fileSystemRule.get(), consistencyCheckService, To.storeVersion());
            if (!result.Successful)
            {
                fail("Database is inconsistent after migration.");
            }
        }
Exemple #8
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void populateDbWithConcurrentUpdates() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void PopulateDbWithConcurrentUpdates()
        {
            GraphDatabaseService database = (new TestGraphDatabaseFactory()).newEmbeddedDatabase(_testDirectory.databaseDir());

            try
            {
                RandomValues randomValues = RandomValues.create();
                int          counter      = 1;
                for (int j = 0; j < 100; j++)
                {
                    using (Transaction transaction = database.BeginTx())
                    {
                        for (int i = 0; i < 5; i++)
                        {
                            Node node = database.CreateNode(Label.label("label" + counter));
                            node.SetProperty("property", randomValues.NextValue().asObject());
                        }
                        transaction.Success();
                    }
                    counter++;
                }

                int             populatorCount = 5;
                ExecutorService executor       = Executors.newFixedThreadPool(populatorCount);
                System.Threading.CountdownEvent startSignal = new System.Threading.CountdownEvent(1);
                AtomicBoolean endSignal = new AtomicBoolean();
                for (int i = 0; i < populatorCount; i++)
                {
                    executor.submit(new Populator(this, database, counter, startSignal, endSignal));
                }

                try
                {
                    using (Transaction transaction = database.BeginTx())
                    {
                        database.Schema().indexFor(Label.label("label10")).on("property").create();
                        transaction.Success();
                    }
                    startSignal.Signal();

                    using (Transaction transaction = database.BeginTx())
                    {
                        database.Schema().awaitIndexesOnline(populatorCount, TimeUnit.MINUTES);
                        transaction.Success();
                    }
                }
                finally
                {
                    endSignal.set(true);
                    executor.shutdown();
                    // Basically we don't care to await their completion because they've done their job
                }
            }
            finally
            {
                database.Shutdown();
                ConsistencyCheckService consistencyCheckService = new ConsistencyCheckService();
                Config config = Config.defaults(GraphDatabaseSettings.pagecache_memory, "8m");
                consistencyCheckService.RunFullConsistencyCheck(_testDirectory.databaseLayout(), config, ProgressMonitorFactory.NONE, FormattedLogProvider.toOutputStream(System.out), false);
            }
        }