use of org.neo4j.internal.batchimport.stats.Stat 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.stats.Stat in project neo4j by neo4j.
the class HumanUnderstandableExecutionMonitor method progressOf.
private static long progressOf(StageExecution execution) {
// First see if there's a "progress" stat
Stat progressStat = findProgressStat(execution.steps());
if (progressStat != null) {
return weighted(execution.getStageName(), progressStat.asLong());
}
// No, then do the generic progress calculation by looking at "done_batches"
long doneBatches = last(execution.steps()).stats().stat(Keys.done_batches).asLong();
int batchSize = execution.getConfig().batchSize();
return weighted(execution.getStageName(), doneBatches * batchSize);
}
Aggregations