Search in sources :

Example 1 with NodeLabelsCache

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;
}
Also used : NodeLabelsCache(org.neo4j.internal.batchimport.cache.NodeLabelsCache) MemoryStatsVisitor(org.neo4j.internal.batchimport.cache.MemoryStatsVisitor)

Example 2 with NodeLabelsCache

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);
}
Also used : SimpleStageControl(org.neo4j.internal.batchimport.staging.SimpleStageControl) SimpleStageControl(org.neo4j.internal.batchimport.staging.SimpleStageControl) StageControl(org.neo4j.internal.batchimport.staging.StageControl) NodeLabelsCache(org.neo4j.internal.batchimport.cache.NodeLabelsCache)

Example 3 with NodeLabelsCache

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));
    }
}
Also used : RelationshipCountsStage(org.neo4j.internal.batchimport.RelationshipCountsStage) Configuration(org.neo4j.internal.batchimport.Configuration) NodeCountsStage(org.neo4j.internal.batchimport.NodeCountsStage) NodeLabelsCache(org.neo4j.internal.batchimport.cache.NodeLabelsCache)

Aggregations

NodeLabelsCache (org.neo4j.internal.batchimport.cache.NodeLabelsCache)3 Configuration (org.neo4j.internal.batchimport.Configuration)1 NodeCountsStage (org.neo4j.internal.batchimport.NodeCountsStage)1 RelationshipCountsStage (org.neo4j.internal.batchimport.RelationshipCountsStage)1 MemoryStatsVisitor (org.neo4j.internal.batchimport.cache.MemoryStatsVisitor)1 SimpleStageControl (org.neo4j.internal.batchimport.staging.SimpleStageControl)1 StageControl (org.neo4j.internal.batchimport.staging.StageControl)1