예제 #1
0
//JAVA TO C# CONVERTER WARNING: 'final' parameters are ignored unless the option to convert to C# 7.2 'in' parameters is selected:
//ORIGINAL LINE: public void checkCounts(org.neo4j.kernel.impl.api.CountsAccessor counts, final org.neo4j.consistency.report.ConsistencyReporter reporter, org.neo4j.helpers.progress.ProgressMonitorFactory progressFactory)
        public virtual void CheckCounts(CountsAccessor counts, ConsistencyReporter reporter, ProgressMonitorFactory progressFactory)
        {
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final int nodes = nodeCounts.size();
            int nodes = _nodeCounts.size();
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final int relationships = relationshipCounts.size();
            int relationships = _relationshipCounts.size();
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final int total = nodes + relationships;
            int total = nodes + relationships;
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final java.util.concurrent.atomic.AtomicInteger nodeEntries = new java.util.concurrent.atomic.AtomicInteger(0);
            AtomicInteger nodeEntries = new AtomicInteger(0);
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final java.util.concurrent.atomic.AtomicInteger relationshipEntries = new java.util.concurrent.atomic.AtomicInteger(0);
            AtomicInteger relationshipEntries = new AtomicInteger(0);
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final org.neo4j.helpers.progress.ProgressListener listener = progressFactory.singlePart("Checking node and relationship counts", total);
            ProgressListener listener = progressFactory.SinglePart("Checking node and relationship counts", total);

            listener.Started();
            Counts.accept(new CountsVisitor_AdapterAnonymousInnerClass(this, reporter, nodeEntries, relationshipEntries, listener));
            reporter.ForCounts(new CountsEntry(nodeKey(WILDCARD), nodeEntries.get()), CHECK_NODE_KEY_COUNT);
            reporter.ForCounts(new CountsEntry(relationshipKey(WILDCARD, WILDCARD, WILDCARD), relationshipEntries.get()), CHECK_RELATIONSHIP_KEY_COUNT);
            listener.Done();
        }
예제 #2
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);
        }
예제 #3
0
 public StoreAccess(NeoStores store)
 {
     this._neoStores = store;
     this._counts    = store.Counts;
 }