Skip to content

Commit

Permalink
Fixes a concurrency record counting issue
Browse files Browse the repository at this point in the history
  • Loading branch information
tinwelint committed Jan 5, 2018
1 parent 4a0e402 commit dc1bd29
Showing 1 changed file with 4 additions and 3 deletions.
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
package org.neo4j.unsafe.impl.batchimport; package org.neo4j.unsafe.impl.batchimport;


import java.util.Collection; import java.util.Collection;
import java.util.concurrent.atomic.LongAdder;
import java.util.function.LongFunction; import java.util.function.LongFunction;


import org.neo4j.kernel.impl.store.RecordStore; import org.neo4j.kernel.impl.store.RecordStore;
Expand All @@ -45,7 +46,7 @@ public class UpdateRecordsStep<RECORD extends AbstractBaseRecord>
protected final RecordStore<RECORD> store; protected final RecordStore<RECORD> store;
private final int recordSize; private final int recordSize;
private final PrepareIdSequence prepareIdSequence; private final PrepareIdSequence prepareIdSequence;
private long recordsUpdated; private final LongAdder recordsUpdated = new LongAdder();


public UpdateRecordsStep( StageControl control, Configuration config, RecordStore<RECORD> store, public UpdateRecordsStep( StageControl control, Configuration config, RecordStore<RECORD> store,
PrepareIdSequence prepareIdSequence ) PrepareIdSequence prepareIdSequence )
Expand All @@ -70,7 +71,7 @@ protected void process( RECORD[] batch, BatchSender sender ) throws Throwable
recordsUpdatedInThisBatch++; recordsUpdatedInThisBatch++;
} }
} }
recordsUpdated += recordsUpdatedInThisBatch; recordsUpdated.add( recordsUpdatedInThisBatch );
} }


@Override @Override
Expand All @@ -83,7 +84,7 @@ protected void collectStatsProviders( Collection<StatsProvider> into )
@Override @Override
public Stat stat( Key key ) public Stat stat( Key key )
{ {
return key == Keys.io_throughput ? new IoThroughputStat( startTime, endTime, recordSize * recordsUpdated ) : null; return key == Keys.io_throughput ? new IoThroughputStat( startTime, endTime, recordSize * recordsUpdated.sum() ) : null;
} }


@Override @Override
Expand Down

0 comments on commit dc1bd29

Please sign in to comment.