use of org.neo4j.internal.batchimport.cache.NodeLabelsCache in project neo4j by neo4j.
the class ProcessRelationshipCountsDataStepTest method nodeLabelsCache.
private static NodeLabelsCache nodeLabelsCache(long sizeInBytes) {
NodeLabelsCache cache = mock(NodeLabelsCache.class);
doAnswer(invocation -> {
MemoryStatsVisitor visitor = invocation.getArgument(0);
visitor.offHeapUsage(sizeInBytes);
return null;
}).when(cache).acceptMemoryStatsVisitor(any());
return cache;
}
use of org.neo4j.internal.batchimport.cache.NodeLabelsCache in project neo4j by neo4j.
the class ProcessRelationshipCountsDataStepTest method instantiateStep.
private static ProcessRelationshipCountsDataStep instantiateStep(int highLabelId, int highRelationshipTypeId, long labelCacheSize, int maxProcessors, long maxMemory) {
StageControl control = new SimpleStageControl();
NodeLabelsCache cache = nodeLabelsCache(labelCacheSize);
Configuration config = mock(Configuration.class);
when(config.maxNumberOfProcessors()).thenReturn(maxProcessors);
when(config.maxMemoryUsage()).thenReturn(maxMemory);
return new ProcessRelationshipCountsDataStep(control, cache, config, highLabelId, highRelationshipTypeId, mock(CountsAccessor.Updater.class), NumberArrayFactories.OFF_HEAP, ProgressReporter.SILENT, PageCacheTracer.NULL, INSTANCE);
}
use of org.neo4j.internal.batchimport.cache.NodeLabelsCache in project neo4j by neo4j.
the class CountsComputer method populateCountStore.
private void populateCountStore(CountsAccessor.Updater countsUpdater) {
try (NodeLabelsCache cache = new NodeLabelsCache(numberArrayFactory, nodes.getHighId(), highLabelId, memoryTracker)) {
Configuration configuration = Configuration.defaultConfiguration(databaseLayout.databaseDirectory());
// Count nodes
superviseDynamicExecution(new NodeCountsStage(configuration, cache, nodes, highLabelId, countsUpdater, progressMonitor, pageCacheTracer));
// Count relationships
superviseDynamicExecution(new RelationshipCountsStage(configuration, cache, relationships, highLabelId, highRelationshipTypeId, countsUpdater, numberArrayFactory, progressMonitor, pageCacheTracer, memoryTracker));
}
}
Aggregations