use of org.neo4j.internal.batchimport.staging.StageControl 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.staging.StageControl in project neo4j by neo4j.
the class UpdateRecordsStepTest method ioThroughputStatDoesNotOverflow.
@Test
void ioThroughputStatDoesNotOverflow() {
// store with huge record size to force overflow and not create huge batch of records
RecordStore<NodeRecord> store = mock(RecordStore.class);
when(store.getRecordSize()).thenReturn(Integer.MAX_VALUE / 2);
Configuration configuration = mock(Configuration.class);
StageControl stageControl = mock(StageControl.class);
UpdateRecordsStep<NodeRecord> step = new UpdateRecordsStep<>(stageControl, configuration, store, new StorePrepareIdSequence(), PageCacheTracer.NULL);
NodeRecord record = new NodeRecord(1);
record.setInUse(true);
NodeRecord[] batch = new NodeRecord[11];
Arrays.fill(batch, record);
step.process(batch, mock(BatchSender.class), NULL);
Stat stat = step.stat(Keys.io_throughput);
assertThat(stat.asLong()).isGreaterThan(0L);
}
use of org.neo4j.internal.batchimport.staging.StageControl in project neo4j by neo4j.
the class UpdateRecordsStepTest method recordWithReservedIdIsSkipped.
@Test
void recordWithReservedIdIsSkipped() {
RecordStore<NodeRecord> store = mock(NodeStore.class);
StageControl stageControl = mock(StageControl.class);
UpdateRecordsStep<NodeRecord> step = new UpdateRecordsStep<>(stageControl, Configuration.DEFAULT, store, new StorePrepareIdSequence(), PageCacheTracer.NULL);
NodeRecord node1 = new NodeRecord(1);
node1.setInUse(true);
NodeRecord node2 = new NodeRecord(2);
node2.setInUse(true);
NodeRecord nodeWithReservedId = new NodeRecord(INTEGER_MINUS_ONE);
NodeRecord[] batch = { node1, node2, nodeWithReservedId };
step.process(batch, mock(BatchSender.class), NULL);
verify(store).prepareForCommit(eq(node1), any(IdSequence.class), any(CursorContext.class));
verify(store).updateRecord(eq(node1), any(), any(), any());
verify(store).prepareForCommit(eq(node2), any(IdSequence.class), any(CursorContext.class));
verify(store).updateRecord(eq(node2), any(), any(), any());
verify(store, never()).prepareForCommit(eq(nodeWithReservedId), any(IdSequence.class), any(CursorContext.class));
verify(store, never()).updateRecord(eq(nodeWithReservedId), any());
}
Aggregations