Skip to content

Commit

Permalink
Displays correct import counts
Browse files Browse the repository at this point in the history
  • Loading branch information
tinwelint committed Jan 5, 2018
1 parent d43c215 commit caa95c2
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 7 deletions.
Expand Up @@ -85,6 +85,11 @@ public void nodesImported( long nodes )
this.nodes.add( nodes );
}

public void nodesRemoved( long nodes )
{
this.nodes.add( -nodes );
}

public void relationshipsImported( long relationships )
{
this.relationships.add( relationships );
Expand Down
Expand Up @@ -36,9 +36,9 @@
public class DeleteDuplicateNodesStage extends Stage
{
public DeleteDuplicateNodesStage( Configuration config, PrimitiveLongIterator duplicateNodeIds,
BatchingNeoStores neoStore )
BatchingNeoStores neoStore, DataImporter.Monitor storeMonitor )
{
super( "DEDUP", null, config, 0 );
add( new DeleteDuplicateNodesStep( control(), config, duplicateNodeIds, neoStore.getNodeStore() ) );
add( new DeleteDuplicateNodesStep( control(), config, duplicateNodeIds, neoStore.getNodeStore(), storeMonitor ) );
}
}
Expand Up @@ -33,12 +33,17 @@ public class DeleteDuplicateNodesStep extends LonelyProcessingStep
{
private final NodeStore nodeStore;
private final PrimitiveLongIterator nodeIds;
private final DataImporter.Monitor storeMonitor;

public DeleteDuplicateNodesStep( StageControl control, Configuration config, PrimitiveLongIterator nodeIds, NodeStore nodeStore )
private int nodesRemoved;

public DeleteDuplicateNodesStep( StageControl control, Configuration config, PrimitiveLongIterator nodeIds, NodeStore nodeStore,
DataImporter.Monitor storeMonitor )
{
super( control, "DEDUP", config );
this.nodeStore = nodeStore;
this.nodeIds = nodeIds;
this.storeMonitor = storeMonitor;
}

@Override
Expand All @@ -52,6 +57,14 @@ protected void process() throws IOException
cursor.next( duplicateNodeId );
record.setInUse( false );
nodeStore.updateRecord( record );
nodesRemoved++;
}
}

@Override
public void close() throws Exception
{
super.close();
storeMonitor.nodesRemoved( nodesRemoved );
}
}
Expand Up @@ -236,7 +236,7 @@ public void prepareIdMapper()
PrimitiveLongIterator duplicateNodeIds = badCollector.leftOverDuplicateNodesIds();
if ( duplicateNodeIds.hasNext() )
{
executeStage( new DeleteDuplicateNodesStage( config, duplicateNodeIds, neoStore ) );
executeStage( new DeleteDuplicateNodesStage( config, duplicateNodeIds, neoStore, storeUpdateMonitor ) );
}
updatePeakMemoryUsage();
}
Expand Down Expand Up @@ -472,9 +472,8 @@ public void close() throws IOException
{
// We're done, do some final logging about it
long totalTimeMillis = currentTimeMillis() - startTime;
DataStatistics stats = getState( DataStatistics.class );
executionMonitor.done( totalTimeMillis, format( "%n%s%nPeak memory usage: %s", stats, bytes( peakMemoryUsage ) ) );
log.info( "Import completed successfully, took " + duration( totalTimeMillis ) + ". " + stats );
executionMonitor.done( totalTimeMillis, format( "%n%s%nPeak memory usage: %s", storeUpdateMonitor, bytes( peakMemoryUsage ) ) );
log.info( "Import completed successfully, took " + duration( totalTimeMillis ) + ". " + storeUpdateMonitor );

if ( nodeRelationshipCache != null )
{
Expand Down

0 comments on commit caa95c2

Please sign in to comment.