diff --git a/community/kernel-api/src/test/java/org/neo4j/internal/kernel/api/TransactionStateTestBase.java b/community/kernel-api/src/test/java/org/neo4j/internal/kernel/api/TransactionStateTestBase.java
index 0c9ae5dd352a9..9e428c11bca86 100644
--- a/community/kernel-api/src/test/java/org/neo4j/internal/kernel/api/TransactionStateTestBase.java
+++ b/community/kernel-api/src/test/java/org/neo4j/internal/kernel/api/TransactionStateTestBase.java
@@ -58,7 +58,7 @@ public void shouldSeeNodeInTransaction() throws Exception
}
@Test
- public void shouldSeeNewLabelledNodeInTransaction() throws Exception
+ public void shouldSeeNewLabeledNodeInTransaction() throws Exception
{
long nodeId;
int labelId;
diff --git a/community/kernel/src/main/java/org/neo4j/kernel/impl/newapi/NodeCursor.java b/community/kernel/src/main/java/org/neo4j/kernel/impl/newapi/NodeCursor.java
index 876a23d515c09..8c04a564995c3 100644
--- a/community/kernel/src/main/java/org/neo4j/kernel/impl/newapi/NodeCursor.java
+++ b/community/kernel/src/main/java/org/neo4j/kernel/impl/newapi/NodeCursor.java
@@ -24,6 +24,7 @@
import org.neo4j.internal.kernel.api.RelationshipGroupCursor;
import org.neo4j.internal.kernel.api.RelationshipTraversalCursor;
import org.neo4j.io.pagecache.PageCursor;
+import org.neo4j.kernel.api.txstate.TransactionState;
import org.neo4j.kernel.impl.store.NodeLabelsField;
import org.neo4j.kernel.impl.store.RecordCursor;
import org.neo4j.kernel.impl.store.record.DynamicRecord;
@@ -139,18 +140,37 @@ public boolean next()
reset();
return false;
}
+ // Check tx state
+
+ boolean hasChanges = read.hasTxStateWithChanges();
+ TransactionState txs = hasChanges ? read.txState() : null;
do
{
- read.node( this, next++, pageCursor );
+ if ( hasChanges && txs.nodeIsAddedInThisTx( next ) )
+ {
+ setId( next++ );
+ setInUse( true );
+ }
+ else if ( hasChanges && txs.nodeIsDeletedInThisTx( next ) )
+ {
+ next++;
+ setInUse( false );
+ }
+ else
+ {
+ read.node( this, next++, pageCursor );
+ }
if ( next > highMark )
{
if ( highMark == NO_ID )
{
+ //we are using single
next = NO_ID;
return inUse();
}
else
{
+ //Check if there is a new high mark
highMark = read.nodeHighMark();
if ( next > highMark )
{
diff --git a/community/lucene-index/src/test/java/org/neo4j/kernel/impl/newapi/TransactionStateTest.java b/community/lucene-index/src/test/java/org/neo4j/kernel/impl/newapi/TransactionStateTest.java
new file mode 100644
index 0000000000000..2a9a816bac90f
--- /dev/null
+++ b/community/lucene-index/src/test/java/org/neo4j/kernel/impl/newapi/TransactionStateTest.java
@@ -0,0 +1,31 @@
+/*
+ * Copyright (c) 2002-2017 "Neo Technology,"
+ * Network Engine for Objects in Lund AB [http://neotechnology.com]
+ *
+ * This file is part of Neo4j.
+ *
+ * Neo4j is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+package org.neo4j.kernel.impl.newapi;
+
+import org.neo4j.internal.kernel.api.TransactionStateTestBase;
+
+public class TransactionStateTest extends TransactionStateTestBase
+{
+ @Override
+ public WriteTestSupport newTestSupport()
+ {
+ return new WriteTestSupport();
+ }
+}