Beispiel #1
0
        private static void ConsistencyCheckIndexStructure(LabelScanStore labelScanStore, IndexAccessors indexes, ConsistencyReporter report, ProgressMonitorFactory progressMonitorFactory)
        {
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final long schemaIndexCount = org.neo4j.helpers.collection.Iterables.count(indexes.onlineRules());
            long       schemaIndexCount = Iterables.count(indexes.OnlineRules());
            const long additionalCount  = 1;              // LabelScanStore
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final long totalCount = schemaIndexCount + additionalCount;
            long totalCount = schemaIndexCount + additionalCount;
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final org.neo4j.helpers.progress.ProgressListener listener = progressMonitorFactory.singlePart("Index structure consistency check", totalCount);
            ProgressListener listener = progressMonitorFactory.SinglePart("Index structure consistency check", totalCount);

            listener.Started();

            ConsistencyCheckLabelScanStore(labelScanStore, report, listener);
            ConsistencyCheckSchemaIndexes(indexes, report, listener);

            listener.Done();
        }
Beispiel #2
0
        private static void ConsistencyCheckSchemaIndexes(IndexAccessors indexes, ConsistencyReporter report, ProgressListener listener)
        {
            IList <StoreIndexDescriptor> rulesToRemove = new List <StoreIndexDescriptor>();

            foreach (StoreIndexDescriptor onlineRule in indexes.OnlineRules())
            {
                ConsistencyReporter.FormattingDocumentedHandler handler = report.FormattingHandler(RecordType.INDEX);
                ReporterFactory reporterFactory = new ReporterFactory(handler);
                IndexAccessor   accessor        = indexes.AccessorFor(onlineRule);
                if (!accessor.ConsistencyCheck(reporterFactory))
                {
                    rulesToRemove.Add(onlineRule);
                }
                handler.UpdateSummary();
                listener.Add(1);
            }
            foreach (StoreIndexDescriptor toRemove in rulesToRemove)
            {
                indexes.Remove(toRemove);
            }
        }