Search in sources :

Example 1 with Stat

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);
}
Also used : NodeRecord(org.neo4j.kernel.impl.store.record.NodeRecord) BatchSender(org.neo4j.internal.batchimport.staging.BatchSender) StageControl(org.neo4j.internal.batchimport.staging.StageControl) Stat(org.neo4j.internal.batchimport.stats.Stat) StorePrepareIdSequence(org.neo4j.internal.batchimport.store.StorePrepareIdSequence) Test(org.junit.jupiter.api.Test)

Example 2 with Stat

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

Aggregations

Stat (org.neo4j.internal.batchimport.stats.Stat)2 Test (org.junit.jupiter.api.Test)1 BatchSender (org.neo4j.internal.batchimport.staging.BatchSender)1 StageControl (org.neo4j.internal.batchimport.staging.StageControl)1 StorePrepareIdSequence (org.neo4j.internal.batchimport.store.StorePrepareIdSequence)1 NodeRecord (org.neo4j.kernel.impl.store.record.NodeRecord)1