Search in sources :

Example 1 with LookupAccessorsFromRunningDb

use of org.neo4j.consistency.LookupAccessorsFromRunningDb in project neo4j by neo4j.

the class CheckerTestBase method context.

CheckerContext context(int numberOfThreads, ConsistencyFlags consistencyFlags, ConsistencySummaryStatistics inconsistenciesSummary) throws Exception {
    if (context != null) {
        return context;
    }
    // We do this as late as possible because of how it eagerly caches which indexes exist so if the test creates an index
    // this lazy instantiation allows the context to pick it up
    Config config = Config.defaults(neo4j_home, directory.homePath());
    DependencyResolver dependencies = db.getDependencyResolver();
    IndexProviderMap indexProviders = dependencies.resolveDependency(IndexProviderMap.class);
    IndexingService indexingService = dependencies.resolveDependency(IndexingService.class);
    IndexAccessors indexAccessors = new IndexAccessors(indexProviders, neoStores, new IndexSamplingConfig(config), new LookupAccessorsFromRunningDb(indexingService), PageCacheTracer.NULL, tokenHolders, neoStores.getMetaDataStore());
    InconsistencyReport report = new InconsistencyReport(new InconsistencyMessageLogger(NullLog.getInstance()), inconsistenciesSummary);
    monitor = mock(ConsistencyReporter.Monitor.class);
    reporter = new ConsistencyReporter(report, monitor);
    countsState = new CountsState(neoStores, cacheAccess, INSTANCE);
    NodeBasedMemoryLimiter limiter = new NodeBasedMemoryLimiter(pageCache.pageSize() * pageCache.maxCachedPages(), Runtime.getRuntime().maxMemory(), Long.MAX_VALUE, CacheSlots.CACHE_LINE_SIZE_BYTES, nodeStore.getHighId(), 1);
    ProgressMonitorFactory.MultiPartBuilder progress = ProgressMonitorFactory.NONE.multipleParts("Test");
    ParallelExecution execution = new ParallelExecution(numberOfThreads, NOOP_EXCEPTION_HANDLER, IDS_PER_CHUNK);
    context = new CheckerContext(neoStores, indexAccessors, execution, reporter, cacheAccess, tokenHolders, new RecordLoading(neoStores), countsState, limiter, progress, pageCache, PageCacheTracer.NULL, INSTANCE, DebugContext.NO_DEBUG, consistencyFlags);
    context.initialize();
    return context;
}
Also used : IndexSamplingConfig(org.neo4j.kernel.impl.api.index.IndexSamplingConfig) IndexAccessors(org.neo4j.consistency.checking.index.IndexAccessors) InconsistencyReport(org.neo4j.consistency.report.InconsistencyReport) ConsistencyReporter(org.neo4j.consistency.report.ConsistencyReporter) ProgressMonitorFactory(org.neo4j.internal.helpers.progress.ProgressMonitorFactory) Config(org.neo4j.configuration.Config) IndexSamplingConfig(org.neo4j.kernel.impl.api.index.IndexSamplingConfig) IndexProviderMap(org.neo4j.kernel.impl.api.index.IndexProviderMap) DependencyResolver(org.neo4j.common.DependencyResolver) LookupAccessorsFromRunningDb(org.neo4j.consistency.LookupAccessorsFromRunningDb) IndexingService(org.neo4j.kernel.impl.api.index.IndexingService) InconsistencyMessageLogger(org.neo4j.consistency.report.InconsistencyMessageLogger)

Example 2 with LookupAccessorsFromRunningDb

use of org.neo4j.consistency.LookupAccessorsFromRunningDb in project neo4j by neo4j.

the class FullCheckTokenIndexIT method updateNodeLabelIndex.

void updateNodeLabelIndex(GraphDatabaseAPI database, IndexDescriptor index) throws IOException, IndexEntryConflictException {
    DependencyResolver dependencyResolver = database.getDependencyResolver();
    IndexingService indexingService = dependencyResolver.resolveDependency(IndexingService.class);
    IndexAccessors.IndexAccessorLookup indexAccessorLookup = new LookupAccessorsFromRunningDb(indexingService);
    IndexAccessor accessor = indexAccessorLookup.apply(index);
    try (IndexUpdater indexUpdater = accessor.newUpdater(IndexUpdateMode.ONLINE, CursorContext.NULL)) {
        indexUpdater.process(IndexEntryUpdate.change(100, index, new long[0], new long[] { 1 }));
    }
}
Also used : LookupAccessorsFromRunningDb(org.neo4j.consistency.LookupAccessorsFromRunningDb) IndexAccessors(org.neo4j.consistency.checking.index.IndexAccessors) IndexingService(org.neo4j.kernel.impl.api.index.IndexingService) IndexAccessor(org.neo4j.kernel.api.index.IndexAccessor) IndexUpdater(org.neo4j.kernel.api.index.IndexUpdater) DependencyResolver(org.neo4j.common.DependencyResolver)

Example 3 with LookupAccessorsFromRunningDb

use of org.neo4j.consistency.LookupAccessorsFromRunningDb in project neo4j by neo4j.

the class FullCheckTokenIndexIT method check.

private ConsistencySummaryStatistics check(GraphDatabaseAPI database, Config config) throws ConsistencyCheckIncompleteException {
    DependencyResolver dependencyResolver = database.getDependencyResolver();
    RecordStorageEngine storageEngine = dependencyResolver.resolveDependency(RecordStorageEngine.class);
    NeoStores neoStores = storageEngine.testAccessNeoStores();
    IndexingService indexingService = dependencyResolver.resolveDependency(IndexingService.class);
    DirectStoreAccess directStoreAccess = new DirectStoreAccess(neoStores, dependencyResolver.resolveDependency(IndexProviderMap.class), dependencyResolver.resolveDependency(TokenHolders.class), dependencyResolver.resolveDependency(IndexStatisticsStore.class), dependencyResolver.resolveDependency(IdGeneratorFactory.class));
    CountsAccessor countsStore = storageEngine.countsAccessor();
    RelationshipGroupDegreesStore groupDegreesStore = storageEngine.relationshipGroupDegreesStore();
    PageCache pageCache = dependencyResolver.resolveDependency(PageCache.class);
    IndexAccessors.IndexAccessorLookup indexAccessorLookup = new LookupAccessorsFromRunningDb(indexingService);
    FullCheck checker = new FullCheck(ProgressMonitorFactory.NONE, defaultConsistencyCheckThreadsNumber(), ConsistencyFlags.DEFAULT, config, DebugContext.NO_DEBUG, NodeBasedMemoryLimiter.DEFAULT);
    return checker.execute(pageCache, directStoreAccess, () -> (CountsStore) countsStore, () -> groupDegreesStore, indexAccessorLookup, PageCacheTracer.NULL, INSTANCE, logProvider.getLog("test"));
}
Also used : IndexAccessors(org.neo4j.consistency.checking.index.IndexAccessors) DirectStoreAccess(org.neo4j.consistency.store.DirectStoreAccess) RelationshipGroupDegreesStore(org.neo4j.internal.counts.RelationshipGroupDegreesStore) IdGeneratorFactory(org.neo4j.internal.id.IdGeneratorFactory) CountsAccessor(org.neo4j.counts.CountsAccessor) IndexProviderMap(org.neo4j.kernel.impl.api.index.IndexProviderMap) DependencyResolver(org.neo4j.common.DependencyResolver) LookupAccessorsFromRunningDb(org.neo4j.consistency.LookupAccessorsFromRunningDb) RecordStorageEngine(org.neo4j.internal.recordstorage.RecordStorageEngine) IndexingService(org.neo4j.kernel.impl.api.index.IndexingService) NeoStores(org.neo4j.kernel.impl.store.NeoStores) IndexStatisticsStore(org.neo4j.kernel.impl.api.index.stats.IndexStatisticsStore) TokenHolders(org.neo4j.token.TokenHolders) PageCache(org.neo4j.io.pagecache.PageCache)

Example 4 with LookupAccessorsFromRunningDb

use of org.neo4j.consistency.LookupAccessorsFromRunningDb in project neo4j by neo4j.

the class IndexCheckingSelectorTest method checkIndex.

private ConsistencySummaryStatistics checkIndex() throws ConsistencyCheckIncompleteException {
    NeoStores neoStores = recordStorageEngine.testAccessNeoStores();
    DirectStoreAccess directStoreAccess = new DirectStoreAccess(neoStores, indexProviderMap, tokenHolders, indexStatisticsStore, idGeneratorFactory);
    CountsAccessor countsStore = recordStorageEngine.countsAccessor();
    RelationshipGroupDegreesStore groupDegreesStore = recordStorageEngine.relationshipGroupDegreesStore();
    IndexAccessors.IndexAccessorLookup indexAccessorLookup = new LookupAccessorsFromRunningDb(indexingService);
    FullCheck checker = new FullCheck(ProgressMonitorFactory.NONE, defaultConsistencyCheckThreadsNumber(), ConsistencyFlags.DEFAULT, Config.defaults(), debugContext, NodeBasedMemoryLimiter.DEFAULT);
    return checker.execute(pageCache, directStoreAccess, () -> (CountsStore) countsStore, () -> groupDegreesStore, indexAccessorLookup, NULL, INSTANCE, NullLog.getInstance());
}
Also used : LookupAccessorsFromRunningDb(org.neo4j.consistency.LookupAccessorsFromRunningDb) IndexAccessors(org.neo4j.consistency.checking.index.IndexAccessors) FullCheck(org.neo4j.consistency.checking.full.FullCheck) NeoStores(org.neo4j.kernel.impl.store.NeoStores) DirectStoreAccess(org.neo4j.consistency.store.DirectStoreAccess) RelationshipGroupDegreesStore(org.neo4j.internal.counts.RelationshipGroupDegreesStore) CountsAccessor(org.neo4j.counts.CountsAccessor)

Aggregations

LookupAccessorsFromRunningDb (org.neo4j.consistency.LookupAccessorsFromRunningDb)4 IndexAccessors (org.neo4j.consistency.checking.index.IndexAccessors)4 DependencyResolver (org.neo4j.common.DependencyResolver)3 IndexingService (org.neo4j.kernel.impl.api.index.IndexingService)3 DirectStoreAccess (org.neo4j.consistency.store.DirectStoreAccess)2 CountsAccessor (org.neo4j.counts.CountsAccessor)2 RelationshipGroupDegreesStore (org.neo4j.internal.counts.RelationshipGroupDegreesStore)2 IndexProviderMap (org.neo4j.kernel.impl.api.index.IndexProviderMap)2 NeoStores (org.neo4j.kernel.impl.store.NeoStores)2 Config (org.neo4j.configuration.Config)1 FullCheck (org.neo4j.consistency.checking.full.FullCheck)1 ConsistencyReporter (org.neo4j.consistency.report.ConsistencyReporter)1 InconsistencyMessageLogger (org.neo4j.consistency.report.InconsistencyMessageLogger)1 InconsistencyReport (org.neo4j.consistency.report.InconsistencyReport)1 ProgressMonitorFactory (org.neo4j.internal.helpers.progress.ProgressMonitorFactory)1 IdGeneratorFactory (org.neo4j.internal.id.IdGeneratorFactory)1 RecordStorageEngine (org.neo4j.internal.recordstorage.RecordStorageEngine)1 PageCache (org.neo4j.io.pagecache.PageCache)1 IndexAccessor (org.neo4j.kernel.api.index.IndexAccessor)1 IndexUpdater (org.neo4j.kernel.api.index.IndexUpdater)1