diff --git a/community/kernel/src/main/java/org/neo4j/unsafe/impl/batchimport/ParallelBatchImporter.java b/community/kernel/src/main/java/org/neo4j/unsafe/impl/batchimport/ParallelBatchImporter.java index a355fe6e5bef9..dde3559acd88d 100644 --- a/community/kernel/src/main/java/org/neo4j/unsafe/impl/batchimport/ParallelBatchImporter.java +++ b/community/kernel/src/main/java/org/neo4j/unsafe/impl/batchimport/ParallelBatchImporter.java @@ -276,7 +276,8 @@ private void importRelationships( NodeRelationshipCache nodeRelationshipCache, // Stage 5a -- link relationship chains together for dense nodes nodeRelationshipCache.setForwardScan( false ); executeStages( new RelationshipLinkbackStage( topic, config, neoStore.getRelationshipStore(), - nodeRelationshipCache, nextRelationshipId, true/*dense*/ ) ); + nodeRelationshipCache, nextRelationshipId, + relationshipStage.getNextRelationshipId(), true/*dense*/ ) ); nextRelationshipId = relationshipStage.getNextRelationshipId(); nodeRelationshipCache.clearChangedChunks( true/*dense*/ ); // cheap higher level clearing } @@ -290,7 +291,7 @@ private void importRelationships( NodeRelationshipCache nodeRelationshipCache, // Stage 5b -- link relationship chains together for sparse nodes nodeRelationshipCache.setForwardScan( false ); executeStages( new RelationshipLinkbackStage( topic, config, neoStore.getRelationshipStore(), - nodeRelationshipCache, 0, false/*sparse*/ ) ); + nodeRelationshipCache, 0, nextRelationshipId, false/*sparse*/ ) ); if ( minorityRelationshipTypes.length > 0 ) { diff --git a/community/kernel/src/main/java/org/neo4j/unsafe/impl/batchimport/RelationshipLinkbackStage.java b/community/kernel/src/main/java/org/neo4j/unsafe/impl/batchimport/RelationshipLinkbackStage.java index 355118057205d..f3ac9e2cd9772 100644 --- a/community/kernel/src/main/java/org/neo4j/unsafe/impl/batchimport/RelationshipLinkbackStage.java +++ b/community/kernel/src/main/java/org/neo4j/unsafe/impl/batchimport/RelationshipLinkbackStage.java @@ -34,10 +34,10 @@ public class RelationshipLinkbackStage extends Stage { public RelationshipLinkbackStage( String topic, Configuration config, RelationshipStore store, - NodeRelationshipCache cache, long firstRelationshipId, boolean denseNodes ) + NodeRelationshipCache cache, long lowRelationshipId, long highRelationshipId, boolean denseNodes ) { super( "Relationship --> Relationship" + topic, config ); - add( new ReadRecordsStep<>( control(), config, store, backwards( store.getHighId(), firstRelationshipId ) ) ); + add( new ReadRecordsStep<>( control(), config, store, backwards( highRelationshipId, lowRelationshipId ) ) ); add( new RecordProcessorStep<>( control(), "LINK", config, new RelationshipLinkbackProcessor( cache, denseNodes ), false ) ); add( new UpdateRecordsStep<>( control(), config, store ) ); diff --git a/community/kernel/src/test/java/org/neo4j/unsafe/impl/batchimport/RelationshipLinkbackStageTest.java b/community/kernel/src/test/java/org/neo4j/unsafe/impl/batchimport/RelationshipLinkbackStageTest.java index a867686a45278..bcdfebb277180 100644 --- a/community/kernel/src/test/java/org/neo4j/unsafe/impl/batchimport/RelationshipLinkbackStageTest.java +++ b/community/kernel/src/test/java/org/neo4j/unsafe/impl/batchimport/RelationshipLinkbackStageTest.java @@ -41,7 +41,7 @@ public void reservedIdIsSkipped() throws Exception long highId = 5; RelationshipStore store = StoreWithReservedId.newRelationshipStoreMock( highId ); RelationshipLinkbackStage stage = new RelationshipLinkbackStage( "Test", - Configuration.DEFAULT, store, newCache(), 0, false ); + Configuration.DEFAULT, store, newCache(), 0, highId, false ); ExecutionSupervisors.superviseExecution( ExecutionMonitors.invisible(), Configuration.DEFAULT, stage );