示例#1
0
 protected internal override void BeforeProcessing(StoreProcessor processor)
 {
     processor.SchemaRecordCheck = _schemaRecordCheck;
 }
示例#2
0
 protected internal override void AfterProcessing(StoreProcessor processor)
 {
     processor.SchemaRecordCheck = null;
 }
示例#3
0
 public RecordProcessor_AdapterAnonymousInnerClass(StoreProcessor outerInstance, RecordStore <R> store)
 {
     this.outerInstance = outerInstance;
     this._store        = store;
 }
示例#4
0
 public SchemaStoreProcessorTask(string name, Statistics statistics, int threads, RecordStore <R> store, StoreAccess storeAccess, string builderPrefix, SchemaRecordCheck schemaRecordCheck, ProgressMonitorFactory.MultiPartBuilder builder, CacheAccess cacheAccess, StoreProcessor processor, QueueDistribution distribution) : base(name, statistics, threads, store, storeAccess, builderPrefix, builder, cacheAccess, processor, distribution)
 {
     this._schemaRecordCheck = schemaRecordCheck;
 }
示例#5
0
 internal StoreProcessorTask(string name, Statistics statistics, int threads, RecordStore <R> store, StoreAccess storeAccess, string builderPrefix, ProgressMonitorFactory.MultiPartBuilder builder, CacheAccess cacheAccess, StoreProcessor processor, QueueDistribution distribution) : base(name, statistics, threads)
 {
     this._store            = store;
     this._storeAccess      = storeAccess;
     this._cacheAccess      = cacheAccess;
     this._processor        = processor;
     this._distribution     = distribution;
     this._progressListener = builder.ProgressForPart(name + IndexedPartName(store.StorageFile.Name, builderPrefix), store.HighId);
 }
示例#6
0
 protected internal virtual void AfterProcessing(StoreProcessor processor)
 {
     // intentionally empty
 }
示例#7
0
        public virtual IList <ConsistencyCheckerTask> CreateTasksForFullCheck(bool checkLabelScanStore, bool checkIndexes, bool checkGraph)
        {
            IList <ConsistencyCheckerTask> tasks = new List <ConsistencyCheckerTask>();

            if (checkGraph)
            {
                MandatoryProperties mandatoryProperties = new MandatoryProperties(_nativeStores);
                StoreProcessor      processor           = _multiPass.processor(CheckStage.Stage1NSPropsLabels, PROPERTIES);
                tasks.Add(Create(CheckStage.Stage1NSPropsLabels.name(), _nativeStores.NodeStore, processor, ROUND_ROBIN));
                //RelationshipStore pass - check label counts using cached labels, check properties, skip nodes and relationships
                processor = _multiPass.processor(CheckStage.Stage2RSLabels, LABELS);
                _multiPass.reDecorateRelationship(processor, RelationshipRecordCheck.relationshipRecordCheckForwardPass());
                tasks.Add(Create(CheckStage.Stage2RSLabels.name(), _nativeStores.RelationshipStore, processor, ROUND_ROBIN));
                //NodeStore pass - just cache nextRel and inUse
                tasks.Add(new CacheTask.CacheNextRel(CheckStage.Stage3NSNextRel, _cacheAccess, Scanner.scan(_nativeStores.NodeStore)));
                //RelationshipStore pass - check nodes inUse, FirstInFirst, FirstInSecond using cached info
                processor = _multiPass.processor(CheckStage.Stage4RSNextRel, NODES);
                _multiPass.reDecorateRelationship(processor, RelationshipRecordCheck.relationshipRecordCheckBackwardPass(new PropertyChain <>(mandatoryProperties.ForRelationships(_reporter))));
                tasks.Add(Create(CheckStage.Stage4RSNextRel.name(), _nativeStores.RelationshipStore, processor, ROUND_ROBIN));
                //NodeStore pass - just cache nextRel and inUse
                _multiPass.reDecorateNode(processor, NodeRecordCheck.toCheckNextRel(), true);
                _multiPass.reDecorateNode(processor, NodeRecordCheck.toCheckNextRelationshipGroup(), false);
                tasks.Add(new CacheTask.CheckNextRel(CheckStage.Stage5CheckNextRel, _cacheAccess, _nativeStores, processor));
                // source chain
                //RelationshipStore pass - forward scan of source chain using the cache.
                processor = _multiPass.processor(CheckStage.Stage6RSForward, RELATIONSHIPS);
                _multiPass.reDecorateRelationship(processor, RelationshipRecordCheck.relationshipRecordCheckSourceChain());
                tasks.Add(Create(CheckStage.Stage6RSForward.name(), _nativeStores.RelationshipStore, processor, QueueDistribution.RELATIONSHIPS));
                //RelationshipStore pass - reverse scan of source chain using the cache.
                processor = _multiPass.processor(CheckStage.Stage7RSBackward, RELATIONSHIPS);
                _multiPass.reDecorateRelationship(processor, RelationshipRecordCheck.relationshipRecordCheckSourceChain());
                tasks.Add(Create(CheckStage.Stage7RSBackward.name(), _nativeStores.RelationshipStore, processor, QueueDistribution.RELATIONSHIPS));

                //relationshipGroup
                StoreProcessor relGrpProcessor = _multiPass.processor(Stage_Fields.ParallelForward, RELATIONSHIP_GROUPS);
                tasks.Add(Create("RelationshipGroupStore-RelGrp", _nativeStores.RelationshipGroupStore, relGrpProcessor, ROUND_ROBIN));

                PropertyReader propertyReader = new PropertyReader(_nativeStores);
                tasks.Add(RecordScanner(CheckStage.Stage8PSProps.name(), new IterableStore <>(_nativeStores.NodeStore, true), new PropertyAndNode2LabelIndexProcessor(_reporter, checkIndexes ? _indexes : null, propertyReader, _cacheAccess, mandatoryProperties.ForNodes(_reporter)), CheckStage.Stage8PSProps, ROUND_ROBIN, new IterableStore <>(_nativeStores.PropertyStore, true)));

                // Checking that relationships are in their expected relationship indexes.
                IList <StoreIndexDescriptor> relationshipIndexes = Iterables.stream(_indexes.onlineRules()).filter(rule => rule.schema().entityType() == EntityType.RELATIONSHIP).collect(Collectors.toList());
                if (checkIndexes && relationshipIndexes.Count > 0)
                {
                    tasks.Add(RecordScanner(CheckStage.Stage9RSIndexes.name(), new IterableStore <>(_nativeStores.RelationshipStore, true), new RelationshipIndexProcessor(_reporter, _indexes, propertyReader, relationshipIndexes), CheckStage.Stage9RSIndexes, ROUND_ROBIN, new IterableStore <>(_nativeStores.PropertyStore, true)));
                }

                tasks.Add(Create("StringStore-Str", _nativeStores.StringStore, _multiPass.processor(Stage_Fields.SequentialForward, STRINGS), ROUND_ROBIN));
                tasks.Add(Create("ArrayStore-Arrays", _nativeStores.ArrayStore, _multiPass.processor(Stage_Fields.SequentialForward, ARRAYS), ROUND_ROBIN));
            }
            // The schema store is verified in multiple passes that share state since it fits into memory
            // and we care about the consistency of back references (cf. SemanticCheck)
            // PASS 1: Dynamic record chains
            tasks.Add(Create("SchemaStore", _nativeStores.SchemaStore, ROUND_ROBIN));
            // PASS 2: Rule integrity and obligation build up
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final org.neo4j.consistency.checking.SchemaRecordCheck schemaCheck = new org.neo4j.consistency.checking.SchemaRecordCheck(new org.neo4j.kernel.impl.store.SchemaStorage(nativeStores.getSchemaStore()), indexes);
            SchemaRecordCheck schemaCheck = new SchemaRecordCheck(new SchemaStorage(_nativeStores.SchemaStore), _indexes);

            tasks.Add(new SchemaStoreProcessorTask <>("SchemaStoreProcessor-check_rules", _statistics, _numberOfThreads, _nativeStores.SchemaStore, _nativeStores, "check_rules", schemaCheck, _multiPartBuilder, _cacheAccess, _defaultProcessor, ROUND_ROBIN));
            // PASS 3: Obligation verification and semantic rule uniqueness
            tasks.Add(new SchemaStoreProcessorTask <>("SchemaStoreProcessor-check_obligations", _statistics, _numberOfThreads, _nativeStores.SchemaStore, _nativeStores, "check_obligations", schemaCheck.ForObligationChecking(), _multiPartBuilder, _cacheAccess, _defaultProcessor, ROUND_ROBIN));
            if (checkGraph)
            {
                tasks.Add(Create("RelationshipTypeTokenStore", _nativeStores.RelationshipTypeTokenStore, ROUND_ROBIN));
                tasks.Add(Create("PropertyKeyTokenStore", _nativeStores.PropertyKeyTokenStore, ROUND_ROBIN));
                tasks.Add(Create("LabelTokenStore", _nativeStores.LabelTokenStore, ROUND_ROBIN));
                tasks.Add(Create("RelationshipTypeNameStore", _nativeStores.RelationshipTypeNameStore, ROUND_ROBIN));
                tasks.Add(Create("PropertyKeyNameStore", _nativeStores.PropertyKeyNameStore, ROUND_ROBIN));
                tasks.Add(Create("LabelNameStore", _nativeStores.LabelNameStore, ROUND_ROBIN));
                tasks.Add(Create("NodeDynamicLabelStore", _nativeStores.NodeDynamicLabelStore, ROUND_ROBIN));
            }

            ConsistencyReporter filteredReporter = _multiPass.reporter(NODES);

            if (checkLabelScanStore)
            {
                long highId = _nativeStores.NodeStore.HighId;
                tasks.Add(new LabelIndexDirtyCheckTask(this));
                tasks.Add(RecordScanner("LabelScanStore", new GapFreeAllEntriesLabelScanReader(_labelScanStore.allNodeLabelRanges(), highId), new LabelScanDocumentProcessor(filteredReporter, new LabelScanCheck()), Stage_Fields.SequentialForward, ROUND_ROBIN));
            }
            if (checkIndexes)
            {
                tasks.Add(new IndexDirtyCheckTask(this));
                TokenNameLookup tokenNameLookup = new NonTransactionalTokenNameLookup(_tokenHolders, true);
                foreach (StoreIndexDescriptor indexRule in _indexes.onlineRules())
                {
                    tasks.Add(RecordScanner(format("Index_%d", indexRule.Id), new IndexIterator(_indexes.accessorFor(indexRule)), new IndexEntryProcessor(filteredReporter, new IndexCheck(indexRule), indexRule, tokenNameLookup), Stage_Fields.SequentialForward, ROUND_ROBIN));
                }
            }
            return(tasks);
        }
示例#8
0
 internal ConsistencyCheckTasks(ProgressMonitorFactory.MultiPartBuilder multiPartBuilder, StoreProcessor defaultProcessor, StoreAccess nativeStores, Statistics statistics, CacheAccess cacheAccess, LabelScanStore labelScanStore, IndexAccessors indexes, TokenHolders tokenHolders, MultiPassStore.Factory multiPass, ConsistencyReporter reporter, int numberOfThreads)
 {
     this._multiPartBuilder = multiPartBuilder;
     this._defaultProcessor = defaultProcessor;
     this._nativeStores     = nativeStores;
     this._statistics       = statistics;
     this._cacheAccess      = cacheAccess;
     this._tokenHolders     = tokenHolders;
     this._multiPass        = multiPass;
     this._reporter         = reporter;
     this._labelScanStore   = labelScanStore;
     this._indexes          = indexes;
     this._numberOfThreads  = numberOfThreads;
 }
示例#9
0
 private StoreProcessorTask <RECORD> Create <RECORD>(string name, RecordStore <RECORD> input, StoreProcessor processor, QueueDistribution distribution) where RECORD : Org.Neo4j.Kernel.impl.store.record.AbstractBaseRecord
 {
     return(new StoreProcessorTask <RECORD>(name, _statistics, _numberOfThreads, input, _nativeStores, name, _multiPartBuilder, _cacheAccess, processor, distribution));
 }