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;
}
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 }));
}
}
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"));
}
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());
}
Aggregations