Skip to content

Commit

Permalink
Only setup filter state if needed
Browse files Browse the repository at this point in the history
  • Loading branch information
fickludd committed Mar 1, 2018
1 parent 01f73d3 commit 0a11d48
Showing 1 changed file with 14 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -275,13 +275,16 @@ public boolean next()
// - Return first relationship if it's not deleted
// Subsequent relationships need to have same type and direction

read.relationshipFull( this, next, pageCursor );
setupFilterState();

hasChanges = hasChanges();
hasChanges = hasChanges(); // <- will setup filter state if needed
txs = hasChanges ? read.txState() : null;

if ( !hasChanges || !txs.relationshipIsDeletedInThisTx( getId() ) )
if ( filterState == FilterState.NOT_INITIALIZED && filterStore )
{
read.relationshipFull( this, next, pageCursor );
setupFilterState();
}

if ( filterState != FilterState.NOT_INITIALIZED && (!hasChanges || !txs.relationshipIsDeletedInThisTx( getId() ) ) )
{
return true;
}
Expand Down Expand Up @@ -507,6 +510,12 @@ private void reset()
@Override
protected void collectAddedTxStateSnapshot()
{
if ( filterState == FilterState.NOT_INITIALIZED )
{
read.relationshipFull( this, next, pageCursor );
setupFilterState();
}

NodeState nodeState = read.txState().getNodeState( originNodeReference );
addedRelationships = hasTxStateFilter() ?
nodeState.getAddedRelationships( filterState.direction, filterType ) :
Expand Down

0 comments on commit 0a11d48

Please sign in to comment.