diff --git a/community/kernel-api/src/main/java/org/neo4j/internal/kernel/api/ExplicitIndexWrite.java b/community/kernel-api/src/main/java/org/neo4j/internal/kernel/api/ExplicitIndexWrite.java index 735b0104cf4ce..3646d3d417e51 100644 --- a/community/kernel-api/src/main/java/org/neo4j/internal/kernel/api/ExplicitIndexWrite.java +++ b/community/kernel-api/src/main/java/org/neo4j/internal/kernel/api/ExplicitIndexWrite.java @@ -78,7 +78,7 @@ void nodeRemoveFromExplicitIndex( String indexName, long node, String key ) thro * * @param indexName The name of the index * @param relationship The id of the relationship to add - * @param key The key to associate with the node + * @param key The key to associate with the relationship * @param value The value to associate with the relationship and key * @throws ExplicitIndexNotFoundKernelException If there is no explicit index with the given name */ @@ -90,7 +90,7 @@ void relationshipAddToExplicitIndex( String indexName, long relationship, String * * @param indexName The name of the index * @param relationship The id of the relationship to remove - * @param key The key to associate with the node + * @param key The key to associate with the relationship * @param value The value to associate with the relationship and key * @throws ExplicitIndexNotFoundKernelException If there is no explicit index with the given name */ @@ -102,7 +102,7 @@ void relationshipRemoveFromExplicitIndex( String indexName, long relationship, S * * @param indexName The name of the index * @param relationship The id of the relationship to remove - * @param key The key to associate with the node + * @param key The key to associate with the relationship * @throws ExplicitIndexNotFoundKernelException If there is no explicit index with the given name */ void relationshipRemoveFromExplicitIndex( String indexName, long relationship, String key ) diff --git a/community/kernel/src/main/java/org/neo4j/kernel/impl/api/state/NodeStateImpl.java b/community/kernel/src/main/java/org/neo4j/kernel/impl/api/state/NodeStateImpl.java index 183cb6c546b10..53f007c601094 100644 --- a/community/kernel/src/main/java/org/neo4j/kernel/impl/api/state/NodeStateImpl.java +++ b/community/kernel/src/main/java/org/neo4j/kernel/impl/api/state/NodeStateImpl.java @@ -212,9 +212,9 @@ else if ( diff.getRemoved().contains( nodeId ) ) } @Override - public boolean hasChanges() + public boolean hasRelationshipChanges() { - return super.hasChanges() || hasAddedRelationships() || hasRemovedRelationships(); + return hasAddedRelationships() || hasRemovedRelationships(); } @Override @@ -318,13 +318,13 @@ public long getId() } @Override - public boolean hasChanges() + public boolean hasPropertyChanges() { return false; } @Override - public boolean hasPropertyChanges() + public boolean hasRelationshipChanges() { return false; } @@ -364,6 +364,7 @@ public PrimitiveLongIterator getAddedRelationships( Direction direction, int[] r { return null; } + }; } } diff --git a/community/kernel/src/main/java/org/neo4j/kernel/impl/api/state/PropertyContainerStateImpl.java b/community/kernel/src/main/java/org/neo4j/kernel/impl/api/state/PropertyContainerStateImpl.java index 7b0ca1a6810ac..c78f75eca718a 100644 --- a/community/kernel/src/main/java/org/neo4j/kernel/impl/api/state/PropertyContainerStateImpl.java +++ b/community/kernel/src/main/java/org/neo4j/kernel/impl/api/state/PropertyContainerStateImpl.java @@ -202,12 +202,6 @@ public void accept( Visitor visitor ) throws ConstraintValidationException } } - @Override - public boolean hasChanges() - { - return hasPropertyChanges(); - } - @Override public boolean hasPropertyChanges() { diff --git a/community/kernel/src/main/java/org/neo4j/kernel/impl/api/state/RelationshipStateImpl.java b/community/kernel/src/main/java/org/neo4j/kernel/impl/api/state/RelationshipStateImpl.java index fd56c36a18190..987386b248989 100644 --- a/community/kernel/src/main/java/org/neo4j/kernel/impl/api/state/RelationshipStateImpl.java +++ b/community/kernel/src/main/java/org/neo4j/kernel/impl/api/state/RelationshipStateImpl.java @@ -125,13 +125,6 @@ public void accept( Visitor visitor ) throws ConstraintValidationException { } - @Override - public boolean hasChanges() - { - return false; - } - - @Override public boolean hasPropertyChanges() { return false; diff --git a/community/kernel/src/main/java/org/neo4j/kernel/impl/api/state/TxState.java b/community/kernel/src/main/java/org/neo4j/kernel/impl/api/state/TxState.java index b9cb07c9913b2..df3d392d848b7 100644 --- a/community/kernel/src/main/java/org/neo4j/kernel/impl/api/state/TxState.java +++ b/community/kernel/src/main/java/org/neo4j/kernel/impl/api/state/TxState.java @@ -731,7 +731,7 @@ public Cursor augmentSingleNodeCursor( Cursor cursor, long n public Cursor augmentPropertyCursor( Cursor cursor, PropertyContainerState propertyContainerState ) { - return propertyContainerState.hasChanges() ? + return propertyContainerState.hasPropertyChanges() ? propertyCursor.get().init( cursor, propertyContainerState ) : cursor; } @@ -739,7 +739,7 @@ public Cursor augmentPropertyCursor( Cursor cursor, public Cursor augmentSinglePropertyCursor( Cursor cursor, PropertyContainerState propertyContainerState, int propertyKeyId ) { - return propertyContainerState.hasChanges() ? + return propertyContainerState.hasPropertyChanges() ? singlePropertyCursor.get().init( cursor, propertyContainerState, propertyKeyId ) : cursor; } @@ -767,7 +767,7 @@ public Cursor augmentNodeRelationshipCursor( Cursor augmentNodeRelationshipCursor( Cursor getProperties( String... keys ) int[] propertyIds = new int[itemsToReturn]; for ( int i = 0; i < itemsToReturn; i++ ) { - propertyIds[i] = token.propertyKey( keys[i] ); + String key = keys[i]; + if ( key == null ) + { + throw new NullPointerException( String.format( "Key %d was null", i + 1 ) ); + } + propertyIds[i] = token.propertyKey( key ); } try ( NodeCursor nodes = cursors.allocateNodeCursor(); PropertyCursor propertyCursor = cursors.allocatePropertyCursor() ) diff --git a/community/kernel/src/main/java/org/neo4j/kernel/impl/newapi/References.java b/community/kernel/src/main/java/org/neo4j/kernel/impl/newapi/References.java index e8f34ef7ec4e2..113fd46b1961f 100644 --- a/community/kernel/src/main/java/org/neo4j/kernel/impl/newapi/References.java +++ b/community/kernel/src/main/java/org/neo4j/kernel/impl/newapi/References.java @@ -157,13 +157,13 @@ static long setNodeFlag( long reference ) /** * Checks if the property reference really is a node reference * - * @param reference The reference to check + * @param nodeReference The reference to check * @return trueif the reference refers to a node otherwise false */ - static boolean hasNodeFlag( long reference ) + static boolean hasNodeFlag( long nodeReference ) { - assert reference != NO_ID; - return (reference & NODE_MARKER) != 0L; + assert nodeReference != NO_ID; + return (nodeReference & NODE_MARKER) != 0L; } /** @@ -171,12 +171,12 @@ static boolean hasNodeFlag( long reference ) * * This allows us to encode a relationship reference as a property reference so that we can do lookups of changes in the * transaction state. - * @param reference the reference to encode + * @param relationshipReference the reference to encode * @return The encoded reference */ - static long setRelationshipFlag( long reference ) + static long setRelationshipFlag( long relationshipReference ) { - return reference | RELATIONSHIP_MARKER | FLAG_MARKER; + return relationshipReference | RELATIONSHIP_MARKER | FLAG_MARKER; } /** diff --git a/community/kernel/src/main/java/org/neo4j/storageengine/api/txstate/NodeState.java b/community/kernel/src/main/java/org/neo4j/storageengine/api/txstate/NodeState.java index 5f045309d082d..746f3f4f489e5 100644 --- a/community/kernel/src/main/java/org/neo4j/storageengine/api/txstate/NodeState.java +++ b/community/kernel/src/main/java/org/neo4j/storageengine/api/txstate/NodeState.java @@ -26,8 +26,6 @@ import org.neo4j.kernel.api.exceptions.schema.ConstraintValidationException; import org.neo4j.storageengine.api.Direction; -import static java.util.Collections.emptyIterator; - /** * Represents the transactional changes to a node: *
    @@ -61,4 +59,5 @@ void visitLabelChanges( long nodeId, Set added, Set removed ) PrimitiveLongIterator getAddedRelationships( Direction direction, int[] relTypes ); + boolean hasRelationshipChanges(); } diff --git a/community/kernel/src/main/java/org/neo4j/storageengine/api/txstate/PropertyContainerState.java b/community/kernel/src/main/java/org/neo4j/storageengine/api/txstate/PropertyContainerState.java index b8a08eb8b0b21..80a216d7a132d 100644 --- a/community/kernel/src/main/java/org/neo4j/storageengine/api/txstate/PropertyContainerState.java +++ b/community/kernel/src/main/java/org/neo4j/storageengine/api/txstate/PropertyContainerState.java @@ -55,8 +55,6 @@ void visitPropertyChanges( long entityId, Iterator added, Iterator removed ) throws ConstraintValidationException; } - boolean hasChanges(); - boolean hasPropertyChanges(); StorageProperty getChangedProperty( int propertyKeyId ); @@ -106,12 +104,6 @@ public void accept( Visitor visitor ) throws ConstraintValidationException { } - @Override - public boolean hasChanges() - { - return false; - } - @Override public boolean hasPropertyChanges() {