コード例 #1
0
ファイル: FullCheck.cs プロジェクト: Neo4Net/Neo4Net
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: void execute(final org.neo4j.kernel.api.direct.DirectStoreAccess directStoreAccess, final org.neo4j.consistency.checking.CheckDecorator decorator, final org.neo4j.consistency.store.RecordAccess recordAccess, final org.neo4j.consistency.report.InconsistencyReport report, org.neo4j.consistency.checking.cache.CacheAccess cacheAccess, org.neo4j.consistency.report.ConsistencyReporter.Monitor reportMonitor) throws ConsistencyCheckIncompleteException
//JAVA TO C# CONVERTER WARNING: 'final' parameters are ignored unless the option to convert to C# 7.2 'in' parameters is selected:
        internal virtual void Execute(DirectStoreAccess directStoreAccess, CheckDecorator decorator, RecordAccess recordAccess, InconsistencyReport report, CacheAccess cacheAccess, ConsistencyReporter.Monitor reportMonitor)
        {
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final org.neo4j.consistency.report.ConsistencyReporter reporter = new org.neo4j.consistency.report.ConsistencyReporter(recordAccess, report, reportMonitor);
            ConsistencyReporter reporter          = new ConsistencyReporter(recordAccess, report, reportMonitor);
            StoreProcessor      processEverything = new StoreProcessor(decorator, reporter, Stage_Fields.SequentialForward, cacheAccess);

            ProgressMonitorFactory.MultiPartBuilder progress = _progressFactory.multipleParts("Full Consistency Check");
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final org.neo4j.kernel.impl.store.StoreAccess nativeStores = directStoreAccess.nativeStores();
            StoreAccess nativeStores = directStoreAccess.NativeStores();

            try
            {
                using (IndexAccessors indexes = new IndexAccessors(directStoreAccess.Indexes(), nativeStores.SchemaStore, _samplingConfig))
                {
                    MultiPassStore.Factory multiPass   = new MultiPassStore.Factory(decorator, recordAccess, cacheAccess, report, reportMonitor);
                    ConsistencyCheckTasks  taskCreator = new ConsistencyCheckTasks(progress, processEverything, nativeStores, _statistics, cacheAccess, directStoreAccess.LabelScanStore(), indexes, directStoreAccess.TokenHolders(), multiPass, reporter, _threads);

                    if (_checkIndexStructure)
                    {
                        ConsistencyCheckIndexStructure(directStoreAccess.LabelScanStore(), indexes, reporter, _progressFactory);
                    }

                    IList <ConsistencyCheckerTask> tasks = taskCreator.CreateTasksForFullCheck(_checkLabelScanStore, _checkIndexes, _checkGraph);
                    progress.Build();
                    TaskExecutor.Execute(tasks, decorator.prepare);
                }
            }
            catch (Exception e)
            {
                throw new ConsistencyCheckIncompleteException(e);
            }
        }
コード例 #2
0
ファイル: FullCheck.cs プロジェクト: Neo4Net/Neo4Net
//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);
        }