Beispiel #1
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: org.neo4j.consistency.report.ConsistencySummaryStatistics execute(org.neo4j.kernel.api.direct.DirectStoreAccess stores, org.neo4j.logging.Log log, org.neo4j.consistency.report.ConsistencyReporter.Monitor reportMonitor) throws ConsistencyCheckIncompleteException
        internal virtual ConsistencySummaryStatistics Execute(DirectStoreAccess stores, Log log, ConsistencyReporter.Monitor reportMonitor)
        {
            ConsistencySummaryStatistics summary = new ConsistencySummaryStatistics();
            InconsistencyReport          report  = new InconsistencyReport(new InconsistencyMessageLogger(log), summary);

            OwnerCheck             ownerCheck    = new OwnerCheck(_checkPropertyOwners);
            CountsBuilderDecorator countsBuilder = new CountsBuilderDecorator(stores.NativeStores());
            CheckDecorator         decorator     = new Org.Neo4j.Consistency.checking.CheckDecorator_ChainCheckDecorator(ownerCheck, countsBuilder);
            CacheAccess            cacheAccess   = new DefaultCacheAccess(AUTO_WITHOUT_PAGECACHE.newByteArray(stores.NativeStores().NodeStore.HighId, new sbyte[ByteArrayBitsManipulator.MAX_BYTES]), _statistics.Counts, _threads);
            RecordAccess           records       = RecordAccess(stores.NativeStores(), cacheAccess);

            Execute(stores, decorator, records, report, cacheAccess, reportMonitor);
            ownerCheck.ScanForOrphanChains(_progressFactory);

            if (_checkGraph)
            {
                CountsAccessor countsAccessor = stores.NativeStores().Counts;
                bool           checkCounts    = true;
                if (_startCountsStore && countsAccessor is CountsTracker)
                {
                    CountsTracker tracker = ( CountsTracker )countsAccessor;
                    // Perhaps other read-only use cases thinks it's fine to just rebuild an in-memory counts store,
                    // but the consistency checker should instead prevent rebuild and report that the counts store is broken or missing
                    tracker.Initializer = new RebuildPreventingCountsInitializer(this);
                    try
                    {
                        tracker.Start();
                    }
                    catch (Exception e)
                    {
                        log.Error("Counts store is missing, broken or of an older format and will not be consistency checked", e);
                        summary.Update(RecordType.COUNTS, 1, 0);
                        checkCounts = false;
                    }
                }

                if (checkCounts)
                {
                    countsBuilder.CheckCounts(countsAccessor, new ConsistencyReporter(records, report), _progressFactory);
                }
            }

            if (!summary.Consistent)
            {
                log.Warn("Inconsistencies found: " + summary);
            }
            return(summary);
        }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldRunChecksInSingleThreadedPass() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void ShouldRunChecksInSingleThreadedPass()
        {
            // given
            StoreAccess  store       = fixture.directStoreAccess().nativeStores();
            int          threads     = defaultConsistencyCheckThreadsNumber();
            CacheAccess  cacheAccess = new DefaultCacheAccess(new DefaultCounts(threads), threads);
            RecordAccess access      = FullCheck.RecordAccess(store, cacheAccess);

            FullCheck singlePass = new FullCheck(TuningConfiguration, ProgressMonitorFactory.NONE, Statistics.NONE, threads, true);

            ConsistencySummaryStatistics singlePassSummary = new ConsistencySummaryStatistics();
            InconsistencyLogger          logger            = mock(typeof(InconsistencyLogger));
            InvocationLog singlePassChecks = new InvocationLog();

            // when
            singlePass.Execute(fixture.directStoreAccess(), new LogDecorator(singlePassChecks), access, new InconsistencyReport(logger, singlePassSummary), cacheAccess, NO_MONITOR);

            // then
            verifyZeroInteractions(logger);
            assertEquals("Expected no inconsistencies in single pass.", 0, singlePassSummary.TotalInconsistencyCount);
        }
 public InconsistentStoreException(ConsistencySummaryStatistics summary) : base(summary.ToString())
 {
     this._summary = summary;
 }