primitiveProxy, int propertyKey )
- {
- propertyDeleter.removeProperty( primitiveProxy, propertyKey, getPropertyRecords() );
- }
-
- public void primitiveChangeProperty( RecordProxy primitive,
- int propertyKey, Object value )
- {
- propertyCreator.primitiveChangeProperty( primitive, propertyKey, value, getPropertyRecords() );
- }
-
- public void primitiveAddProperty( RecordProxy primitive,
- int propertyKey, Object value )
- {
- propertyCreator.primitiveAddProperty( primitive, propertyKey, value, getPropertyRecords() );
- }
-
- public void createPropertyKeyToken( String name, int id )
- {
- TokenCreator creator =
- new TokenCreator<>( neoStores.getPropertyKeyTokenStore() );
- creator.createToken( name, id, getPropertyKeyTokenRecords() );
- }
-
- public void createLabelToken( String name, int id )
- {
- TokenCreator creator =
- new TokenCreator<>( neoStores.getLabelTokenStore() );
- creator.createToken( name, id, getLabelTokenRecords() );
- }
-
- public void createRelationshipTypeToken( String name, int id )
- {
- TokenCreator creator =
- new TokenCreator<>( neoStores.getRelationshipTypeTokenStore() );
- creator.createToken( name, id, getRelationshipTypeTokenRecords() );
- }
-
- public void clear()
- {
- recordChangeSet.close();
- }
-
- public RecordAccess getNodeRecords()
- {
- return recordChangeSet.getNodeRecords();
- }
-
- public RecordAccess getRelRecords()
- {
- return recordChangeSet.getRelRecords();
- }
-
- public RecordAccess, SchemaRule> getSchemaRuleChanges()
- {
- return recordChangeSet.getSchemaRuleChanges();
- }
-
- public RecordAccess getPropertyRecords()
- {
- return recordChangeSet.getPropertyRecords();
- }
-
- public RecordAccess getRelGroupRecords()
- {
- return recordChangeSet.getRelGroupRecords();
- }
-
- public RecordAccess getPropertyKeyTokenRecords()
- {
- return recordChangeSet.getPropertyKeyTokenChanges();
- }
-
- public RecordAccess getLabelTokenRecords()
- {
- return recordChangeSet.getLabelTokenChanges();
- }
-
- public RecordAccess getRelationshipTypeTokenRecords()
- {
- return recordChangeSet.getRelationshipTypeTokenChanges();
- }
-
- public RecordProxy getRelationshipGroup( NodeRecord node, int type )
- {
- long groupId = node.getNextRel();
- long previousGroupId = Record.NO_NEXT_RELATIONSHIP.intValue();
- while ( groupId != Record.NO_NEXT_RELATIONSHIP.intValue() )
- {
- RecordProxy change =
- recordChangeSet.getRelGroupRecords().getOrLoad( groupId, type );
- RelationshipGroupRecord record = change.forReadingData();
- record.setPrev( previousGroupId ); // not persistent so not a "change"
- if ( record.getType() == type )
- {
- return change;
- }
- previousGroupId = groupId;
- groupId = record.getNext();
- }
- return null;
- }
-
- public boolean hasChanges()
- {
- return recordChangeSet.hasChanges();
- }
-}
diff --git a/community/kernel/src/main/java/org/neo4j/kernel/impl/transaction/state/RecordAccessSet.java b/community/kernel/src/main/java/org/neo4j/kernel/impl/transaction/state/RecordAccessSet.java
index cf154857965af..1ec3f6e5b05d8 100644
--- a/community/kernel/src/main/java/org/neo4j/kernel/impl/transaction/state/RecordAccessSet.java
+++ b/community/kernel/src/main/java/org/neo4j/kernel/impl/transaction/state/RecordAccessSet.java
@@ -52,5 +52,7 @@ public interface RecordAccessSet
boolean hasChanges();
+ int changeSize();
+
void close();
}
diff --git a/community/kernel/src/main/java/org/neo4j/kernel/impl/transaction/state/RecordChangeSet.java b/community/kernel/src/main/java/org/neo4j/kernel/impl/transaction/state/RecordChangeSet.java
index 0b7b4598f0c41..c613e3afc420e 100644
--- a/community/kernel/src/main/java/org/neo4j/kernel/impl/transaction/state/RecordChangeSet.java
+++ b/community/kernel/src/main/java/org/neo4j/kernel/impl/transaction/state/RecordChangeSet.java
@@ -132,6 +132,12 @@ public boolean hasChanges()
return changeCounter.value() > 0;
}
+ @Override
+ public int changeSize()
+ {
+ return changeCounter.value();
+ }
+
@Override
public void close()
{
diff --git a/community/kernel/src/main/java/org/neo4j/kernel/impl/transaction/state/TransactionRecordState.java b/community/kernel/src/main/java/org/neo4j/kernel/impl/transaction/state/TransactionRecordState.java
index 806f5fb654062..add7e3bde6b7a 100644
--- a/community/kernel/src/main/java/org/neo4j/kernel/impl/transaction/state/TransactionRecordState.java
+++ b/community/kernel/src/main/java/org/neo4j/kernel/impl/transaction/state/TransactionRecordState.java
@@ -29,6 +29,7 @@
import org.neo4j.kernel.api.exceptions.TransactionFailureException;
import org.neo4j.kernel.api.properties.DefinedProperty;
import org.neo4j.kernel.api.properties.Property;
+import org.neo4j.kernel.impl.core.RelationshipTypeToken;
import org.neo4j.kernel.impl.store.MetaDataStore;
import org.neo4j.kernel.impl.store.NeoStores;
import org.neo4j.kernel.impl.store.NodeStore;
@@ -51,6 +52,8 @@
import org.neo4j.kernel.impl.util.statistics.IntCounter;
import org.neo4j.storageengine.api.StorageCommand;
import org.neo4j.storageengine.api.StorageProperty;
+import org.neo4j.storageengine.api.Token;
+import org.neo4j.storageengine.api.lock.ResourceLocker;
import org.neo4j.storageengine.api.schema.SchemaRule;
import static org.neo4j.kernel.impl.store.NodeLabelsField.parseLabelsField;
@@ -76,55 +79,48 @@
*/
public class TransactionRecordState implements RecordState
{
+ private final NeoStores neoStores;
private final IntegrityValidator integrityValidator;
- private final NeoStoreTransactionContext context;
private final NodeStore nodeStore;
private final MetaDataStore metaDataStore;
private final SchemaStore schemaStore;
+ private final RecordAccessSet recordChangeSet;
+ private final long lastCommittedTxWhenTransactionStarted;
+ private final ResourceLocker locks;
+ private final RelationshipCreator relationshipCreator;
+ private final RelationshipDeleter relationshipDeleter;
+ private final PropertyCreator propertyCreator;
+ private final PropertyDeleter propertyDeleter;
private RecordChanges neoStoreRecord;
- private long lastCommittedTxWhenTransactionStarted;
private boolean prepared;
public TransactionRecordState( NeoStores neoStores, IntegrityValidator integrityValidator,
- NeoStoreTransactionContext context )
- {
+ RecordChangeSet recordChangeSet, long lastCommittedTxWhenTransactionStarted,
+ ResourceLocker locks,
+ RelationshipCreator relationshipCreator,
+ RelationshipDeleter relationshipDeleter,
+ PropertyCreator propertyCreator,
+ PropertyDeleter propertyDeleter )
+ {
+ this.neoStores = neoStores;
this.nodeStore = neoStores.getNodeStore();
this.metaDataStore = neoStores.getMetaDataStore();
this.schemaStore = neoStores.getSchemaStore();
this.integrityValidator = integrityValidator;
- this.context = context;
- }
-
- /**
- * Set this record state to a pristine state, acting as if it had never been used.
- *
- * @param lastCommittedTxWhenTransactionStarted is the highest committed transaction id when this transaction
- * begun. No operations in this transaction are allowed to have
- * taken place before that transaction id. This is used by
- * constraint validation - if a constraint was not online when this
- * transaction begun, it will be verified during prepare. If you are
- * writing code against this API and are unsure about what to set
- * this value to, 0 is a safe choice. That will ensure all
- * constraints are checked.
- */
- public void initialize( long lastCommittedTxWhenTransactionStarted )
- {
+ this.recordChangeSet = recordChangeSet;
this.lastCommittedTxWhenTransactionStarted = lastCommittedTxWhenTransactionStarted;
- prepared = false;
- }
-
- public void clear()
- {
- // no point in caching neostore record changes since they are rare, let's simply make sure they are cleared
- neoStoreRecord = null;
- context.clear();
+ this.locks = locks;
+ this.relationshipCreator = relationshipCreator;
+ this.relationshipDeleter = relationshipDeleter;
+ this.propertyCreator = propertyCreator;
+ this.propertyDeleter = propertyDeleter;
}
@Override
public boolean hasChanges()
{
- return context.hasChanges() ||
+ return recordChangeSet.hasChanges() ||
(neoStoreRecord != null && neoStoreRecord.changeSize() > 0);
}
@@ -135,32 +131,27 @@ public void extractCommands( Collection commands ) throws Transa
integrityValidator.validateTransactionStartKnowledge( lastCommittedTxWhenTransactionStarted );
- int noOfCommands = context.getNodeRecords().changeSize() +
- context.getRelRecords().changeSize() +
- context.getPropertyRecords().changeSize() +
- context.getSchemaRuleChanges().changeSize() +
- context.getPropertyKeyTokenRecords().changeSize() +
- context.getLabelTokenRecords().changeSize() +
- context.getRelationshipTypeTokenRecords().changeSize() +
- context.getRelGroupRecords().changeSize() +
+ int noOfCommands = recordChangeSet.changeSize() +
(neoStoreRecord != null ? neoStoreRecord.changeSize() : 0);
- for ( RecordProxy record : context.getLabelTokenRecords().changes() )
+ for ( RecordProxy record : recordChangeSet.getLabelTokenChanges().changes() )
{
commands.add( new Command.LabelTokenCommand( record.getBefore(), record.forReadingLinkage() ) );
}
- for ( RecordProxy record : context.getRelationshipTypeTokenRecords().changes() )
+ for ( RecordProxy record :
+ recordChangeSet.getRelationshipTypeTokenChanges().changes() )
{
commands.add( new Command.RelationshipTypeTokenCommand( record.getBefore(), record.forReadingLinkage() ) );
}
- for ( RecordProxy record : context.getPropertyKeyTokenRecords().changes() )
+ for ( RecordProxy record :
+ recordChangeSet.getPropertyKeyTokenChanges().changes() )
{
commands.add( new Command.PropertyKeyTokenCommand( record.getBefore(), record.forReadingLinkage() ) );
}
// Collect nodes, relationships, properties
- List nodeCommands = new ArrayList<>( context.getNodeRecords().changeSize() );
- for ( RecordProxy change : context.getNodeRecords().changes() )
+ List nodeCommands = new ArrayList<>( recordChangeSet.getNodeRecords().changeSize() );
+ for ( RecordProxy change : recordChangeSet.getNodeRecords().changes() )
{
NodeRecord record = change.forReadingLinkage();
integrityValidator.validateNodeRecord( record );
@@ -168,22 +159,24 @@ public void extractCommands( Collection commands ) throws Transa
}
Collections.sort( nodeCommands, COMMAND_SORTER );
- List relCommands = new ArrayList<>( context.getRelRecords().changeSize() );
- for ( RecordProxy change : context.getRelRecords().changes() )
+ List relCommands = new ArrayList<>( recordChangeSet.getRelRecords().changeSize() );
+ for ( RecordProxy change : recordChangeSet.getRelRecords().changes() )
{
relCommands.add( new Command.RelationshipCommand( change.getBefore(), change.forReadingLinkage() ) );
}
Collections.sort( relCommands, COMMAND_SORTER );
- List propCommands = new ArrayList<>( context.getPropertyRecords().changeSize() );
- for ( RecordProxy change : context.getPropertyRecords().changes() )
+ List propCommands = new ArrayList<>( recordChangeSet.getPropertyRecords().changeSize() );
+ for ( RecordProxy change :
+ recordChangeSet.getPropertyRecords().changes() )
{
propCommands.add( new Command.PropertyCommand( change.getBefore(), change.forReadingLinkage() ) );
}
Collections.sort( propCommands, COMMAND_SORTER );
- List relGroupCommands = new ArrayList<>( context.getRelGroupRecords().changeSize() );
- for ( RecordProxy change : context.getRelGroupRecords().changes() )
+ List relGroupCommands = new ArrayList<>( recordChangeSet.getRelGroupRecords().changeSize() );
+ for ( RecordProxy change :
+ recordChangeSet.getRelGroupRecords().changes() )
{
relGroupCommands.add( new Command.RelationshipGroupCommand( change.getBefore(), change.forReadingData() ) );
}
@@ -200,7 +193,8 @@ public void extractCommands( Collection commands ) throws Transa
commands.add( new Command.NeoStoreCommand( change.getBefore(), change.forReadingData() ) );
}
}
- for ( RecordProxy, SchemaRule> change : context.getSchemaRuleChanges().changes() )
+ for ( RecordProxy, SchemaRule> change :
+ recordChangeSet.getSchemaRuleChanges().changes() )
{
integrityValidator.validateSchemaRule( change.getAdditionalData() );
commands.add( new Command.SchemaRuleCommand(
@@ -214,12 +208,12 @@ public void extractCommands( Collection commands ) throws Transa
public void relCreate( long id, int typeId, long startNodeId, long endNodeId )
{
- context.relationshipCreate( id, typeId, startNodeId, endNodeId );
+ relationshipCreator.relationshipCreate( id, typeId, startNodeId, endNodeId, recordChangeSet, locks );
}
public void relDelete( long relId )
{
- context.relationshipDelete( relId );
+ relationshipDeleter.relDelete( relId, recordChangeSet, locks );
}
@SafeVarargs
@@ -245,7 +239,7 @@ private final void addFiltered( Collection target, Mode mode,
*/
public void nodeDelete( long nodeId )
{
- NodeRecord nodeRecord = context.getNodeRecords().getOrLoad( nodeId, null ).forChangingData();
+ NodeRecord nodeRecord = recordChangeSet.getNodeRecords().getOrLoad( nodeId, null ).forChangingData();
if ( !nodeRecord.inUse() )
{
throw new IllegalStateException( "Unable to delete Node[" + nodeId +
@@ -268,7 +262,7 @@ private Collection markNotInUse( Collection dynami
private void getAndDeletePropertyChain( NodeRecord nodeRecord )
{
- context.getAndDeletePropertyChain( nodeRecord );
+ propertyDeleter.deletePropertyChain( nodeRecord, recordChangeSet.getPropertyRecords() );
}
/**
@@ -281,8 +275,8 @@ private void getAndDeletePropertyChain( NodeRecord nodeRecord )
*/
public void relRemoveProperty( long relId, int propertyKey )
{
- RecordProxy rel = context.getRelRecords().getOrLoad( relId, null );
- context.removeProperty( rel, propertyKey );
+ RecordProxy rel = recordChangeSet.getRelRecords().getOrLoad( relId, null );
+ propertyDeleter.removeProperty( rel, propertyKey, recordChangeSet.getPropertyRecords() );
}
/**
@@ -294,8 +288,8 @@ public void relRemoveProperty( long relId, int propertyKey )
*/
public void nodeRemoveProperty( long nodeId, int propertyKey )
{
- RecordProxy node = context.getNodeRecords().getOrLoad( nodeId, null );
- context.removeProperty( node, propertyKey );
+ RecordProxy node = recordChangeSet.getNodeRecords().getOrLoad( nodeId, null );
+ propertyDeleter.removeProperty( node, propertyKey, recordChangeSet.getPropertyRecords() );
}
/**
@@ -310,8 +304,8 @@ public void nodeRemoveProperty( long nodeId, int propertyKey )
*/
public DefinedProperty relChangeProperty( long relId, int propertyKey, Object value )
{
- RecordProxy rel = context.getRelRecords().getOrLoad( relId, null );
- context.primitiveChangeProperty( rel, propertyKey, value );
+ RecordProxy rel = recordChangeSet.getRelRecords().getOrLoad( relId, null );
+ propertyCreator.primitiveChangeProperty( rel, propertyKey, value, recordChangeSet.getPropertyRecords() );
return Property.property( propertyKey, value );
}
@@ -326,8 +320,8 @@ public DefinedProperty relChangeProperty( long relId, int propertyKey, Object va
*/
public DefinedProperty nodeChangeProperty( long nodeId, int propertyKey, Object value )
{
- RecordProxy node = context.getNodeRecords().getOrLoad( nodeId, null ); //getNodeRecord( nodeId );
- context.primitiveChangeProperty( node, propertyKey, value );
+ RecordProxy node = recordChangeSet.getNodeRecords().getOrLoad( nodeId, null );
+ propertyCreator.primitiveChangeProperty( node, propertyKey, value, recordChangeSet.getPropertyRecords() );
return Property.property( propertyKey, value );
}
@@ -342,8 +336,8 @@ public DefinedProperty nodeChangeProperty( long nodeId, int propertyKey, Object
*/
public DefinedProperty relAddProperty( long relId, int propertyKey, Object value )
{
- RecordProxy rel = context.getRelRecords().getOrLoad( relId, null );
- context.primitiveAddProperty( rel, propertyKey, value );
+ RecordProxy rel = recordChangeSet.getRelRecords().getOrLoad( relId, null );
+ propertyCreator.primitiveAddProperty( rel, propertyKey, value, recordChangeSet.getPropertyRecords() );
return Property.property( propertyKey, value );
}
@@ -357,8 +351,8 @@ public DefinedProperty relAddProperty( long relId, int propertyKey, Object value
*/
public DefinedProperty nodeAddProperty( long nodeId, int propertyKey, Object value )
{
- RecordProxy node = context.getNodeRecords().getOrLoad( nodeId, null );
- context.primitiveAddProperty( node, propertyKey, value );
+ RecordProxy node = recordChangeSet.getNodeRecords().getOrLoad( nodeId, null );
+ propertyCreator.primitiveAddProperty( node, propertyKey, value, recordChangeSet.getPropertyRecords() );
return Property.property( propertyKey, value );
}
@@ -369,7 +363,7 @@ public DefinedProperty nodeAddProperty( long nodeId, int propertyKey, Object val
*/
public void nodeCreate( long nodeId )
{
- NodeRecord nodeRecord = context.getNodeRecords().create( nodeId, null ).forChangingData();
+ NodeRecord nodeRecord = recordChangeSet.getNodeRecords().create( nodeId, null ).forChangingData();
nodeRecord.setInUse( true );
nodeRecord.setCreated();
}
@@ -382,7 +376,9 @@ public void nodeCreate( long nodeId )
*/
public void createPropertyKeyToken( String key, int id )
{
- context.createPropertyKeyToken( key, id );
+ TokenCreator creator =
+ new TokenCreator<>( neoStores.getPropertyKeyTokenStore() );
+ creator.createToken( key, id, recordChangeSet.getPropertyKeyTokenChanges() );
}
/**
@@ -393,7 +389,9 @@ public void createPropertyKeyToken( String key, int id )
*/
public void createLabelToken( String name, int id )
{
- context.createLabelToken( name, id );
+ TokenCreator creator =
+ new TokenCreator<>( neoStores.getLabelTokenStore() );
+ creator.createToken( name, id, recordChangeSet.getLabelTokenChanges() );
}
/**
@@ -405,7 +403,9 @@ public void createLabelToken( String name, int id )
*/
public void createRelationshipTypeToken( String name, int id )
{
- context.createRelationshipTypeToken( name, id );
+ TokenCreator creator =
+ new TokenCreator<>( neoStores.getRelationshipTypeTokenStore() );
+ creator.createToken( name, id, recordChangeSet.getRelationshipTypeTokenChanges() );
}
private static class CommandSorter implements Comparator
@@ -488,7 +488,8 @@ public NeoStoreRecord clone( NeoStoreRecord neoStoreRecord )
*/
public DefinedProperty graphAddProperty( int propertyKey, Object value )
{
- context.primitiveAddProperty( getOrLoadNeoStoreRecord(), propertyKey, value );
+ propertyCreator.primitiveAddProperty( getOrLoadNeoStoreRecord(), propertyKey, value,
+ recordChangeSet.getPropertyRecords() );
return Property.property( propertyKey, value );
}
@@ -502,7 +503,8 @@ public DefinedProperty graphAddProperty( int propertyKey, Object value )
*/
public DefinedProperty graphChangeProperty( int propertyKey, Object value )
{
- context.primitiveChangeProperty( getOrLoadNeoStoreRecord(), propertyKey, value );
+ propertyCreator.primitiveChangeProperty( getOrLoadNeoStoreRecord(), propertyKey, value,
+ recordChangeSet.getPropertyRecords() );
return Property.property( propertyKey, value );
}
@@ -515,12 +517,13 @@ public DefinedProperty graphChangeProperty( int propertyKey, Object value )
public void graphRemoveProperty( int propertyKey )
{
RecordProxy recordChange = getOrLoadNeoStoreRecord();
- context.removeProperty( recordChange, propertyKey );
+ propertyDeleter.removeProperty( recordChange, propertyKey, recordChangeSet.getPropertyRecords() );
}
public void createSchemaRule( SchemaRule schemaRule )
{
- for(DynamicRecord change : context.getSchemaRuleChanges().create( schemaRule.getId(), schemaRule ).forChangingData())
+ for( DynamicRecord change : recordChangeSet.getSchemaRuleChanges()
+ .create( schemaRule.getId(), schemaRule ).forChangingData() )
{
change.setInUse( true );
change.setCreated();
@@ -530,7 +533,7 @@ public void createSchemaRule( SchemaRule schemaRule )
public void dropSchemaRule( SchemaRule rule )
{
RecordProxy, SchemaRule> change =
- context.getSchemaRuleChanges().getOrLoad( rule.getId(), rule );
+ recordChangeSet.getSchemaRuleChanges().getOrLoad( rule.getId(), rule );
Collection records = change.forChangingData();
for ( DynamicRecord record : records )
{
@@ -540,20 +543,20 @@ public void dropSchemaRule( SchemaRule rule )
public void addLabelToNode( int labelId, long nodeId )
{
- NodeRecord nodeRecord = context.getNodeRecords().getOrLoad( nodeId, null ).forChangingData();
+ NodeRecord nodeRecord = recordChangeSet.getNodeRecords().getOrLoad( nodeId, null ).forChangingData();
parseLabelsField( nodeRecord ).add( labelId, nodeStore, nodeStore.getDynamicLabelStore() );
}
public void removeLabelFromNode( int labelId, long nodeId )
{
- NodeRecord nodeRecord = context.getNodeRecords().getOrLoad( nodeId, null ).forChangingData();
+ NodeRecord nodeRecord = recordChangeSet.getNodeRecords().getOrLoad( nodeId, null ).forChangingData();
parseLabelsField( nodeRecord ).remove( labelId, nodeStore );
}
public void setConstraintIndexOwner( IndexRule indexRule, long constraintId )
{
RecordProxy, SchemaRule> change =
- context.getSchemaRuleChanges().getOrLoad( indexRule.getId(), indexRule );
+ recordChangeSet.getSchemaRuleChanges().getOrLoad( indexRule.getId(), indexRule );
Collection records = change.forChangingData();
indexRule = indexRule.withOwningConstraint( constraintId );
diff --git a/community/kernel/src/main/java/org/neo4j/unsafe/batchinsert/DirectRecordAccessSet.java b/community/kernel/src/main/java/org/neo4j/unsafe/batchinsert/DirectRecordAccessSet.java
index 64c3157568b8e..ec47993497993 100644
--- a/community/kernel/src/main/java/org/neo4j/unsafe/batchinsert/DirectRecordAccessSet.java
+++ b/community/kernel/src/main/java/org/neo4j/unsafe/batchinsert/DirectRecordAccessSet.java
@@ -52,7 +52,8 @@ public class DirectRecordAccessSet implements RecordAccessSet
private final DirectRecordAccess propertyKeyTokenRecords;
private final DirectRecordAccess relationshipTypeTokenRecords;
private final DirectRecordAccess labelTokenRecords;
-// private final DirectRecordAccess, SchemaRule> schemaRecords; // TODO
+ // TODO add schema rule access?
+ private final DirectRecordAccess[] all;
public DirectRecordAccessSet( NeoStores neoStores )
{
@@ -73,7 +74,10 @@ public DirectRecordAccessSet( NeoStores neoStores )
relationshipTypeTokenRecords = new DirectRecordAccess<>(
relationshipTypeTokenStore, loaders.relationshipTypeTokenLoader() );
labelTokenRecords = new DirectRecordAccess<>( labelTokenStore, loaders.labelTokenLoader() );
-// schemaRecords = new DirectRecordAccess<>( neoStores.getSchemaStore(), loaders.schemaRuleLoader() ); // TODO
+ all = new DirectRecordAccess[] {
+ nodeRecords, propertyRecords, relationshipRecords, relationshipGroupRecords,
+ propertyKeyTokenRecords, relationshipTypeTokenRecords, labelTokenRecords
+ };
}
@Override
@@ -128,37 +132,41 @@ public RecordAccess getRelationshipT
public void close()
{
commit();
- nodeRecords.close();
- propertyRecords.close();
- relationshipRecords.close();
- relationshipGroupRecords.close();
-// schemaRecords.close(); // TODO
- relationshipTypeTokenRecords.close();
- labelTokenRecords.close();
- propertyKeyTokenRecords.close();
+ for ( DirectRecordAccess access : all )
+ {
+ access.close();
+ }
}
public void commit()
{
- nodeRecords.commit();
- propertyRecords.commit();
- relationshipGroupRecords.commit();
- relationshipRecords.commit();
-// schemaRecords.commit(); // TODO
- relationshipTypeTokenRecords.commit();
- labelTokenRecords.commit();
- propertyKeyTokenRecords.commit();
+ for ( DirectRecordAccess access : all )
+ {
+ access.commit();
+ }
}
@Override
public boolean hasChanges()
{
- return nodeRecords.changeSize() > 0 ||
- propertyRecords.changeSize() > 0 ||
- relationshipRecords.changeSize() > 0 ||
- relationshipGroupRecords.changeSize() > 0 ||
- propertyKeyTokenRecords.changeSize() > 0 ||
- labelTokenRecords.changeSize() > 0 ||
- relationshipTypeTokenRecords.changeSize() > 0;
+ for ( DirectRecordAccess access : all )
+ {
+ if ( access.changeSize() > 0 )
+ {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ @Override
+ public int changeSize()
+ {
+ int total = 0;
+ for ( DirectRecordAccess access : all )
+ {
+ total += access.changeSize();
+ }
+ return total;
}
}
diff --git a/community/kernel/src/main/java/org/neo4j/unsafe/impl/batchimport/store/BatchingRecordAccess.java b/community/kernel/src/main/java/org/neo4j/unsafe/impl/batchimport/store/BatchingRecordAccess.java
index 7d5a2bbfbf6a4..22a78afab3f0d 100644
--- a/community/kernel/src/main/java/org/neo4j/unsafe/impl/batchimport/store/BatchingRecordAccess.java
+++ b/community/kernel/src/main/java/org/neo4j/unsafe/impl/batchimport/store/BatchingRecordAccess.java
@@ -22,13 +22,13 @@
import java.util.Collection;
import org.neo4j.helpers.collection.IterableWrapper;
-import org.neo4j.kernel.impl.transaction.state.NeoStoreTransactionContext;
import org.neo4j.kernel.impl.transaction.state.RecordAccess;
+import org.neo4j.kernel.impl.transaction.state.TransactionRecordState;
import org.neo4j.kernel.impl.util.collection.ArrayCollection;
/**
* {@link RecordAccess} optimized for batching and an access pattern where records are created sequentially.
- * Mostly here as a bridge between a batch importer and existing record logic in {@link NeoStoreTransactionContext}
+ * Mostly here as a bridge between a batch importer and existing record logic in {@link TransactionRecordState}
* and friends.
*/
public abstract class BatchingRecordAccess implements RecordAccess
diff --git a/community/kernel/src/test/java/org/neo4j/kernel/impl/transaction/state/RelationshipCreatorTest.java b/community/kernel/src/test/java/org/neo4j/kernel/impl/transaction/state/RelationshipCreatorTest.java
index 360c4ca65c8f5..e7f7a40c7d37e 100644
--- a/community/kernel/src/test/java/org/neo4j/kernel/impl/transaction/state/RelationshipCreatorTest.java
+++ b/community/kernel/src/test/java/org/neo4j/kernel/impl/transaction/state/RelationshipCreatorTest.java
@@ -189,6 +189,12 @@ public boolean hasChanges()
{
return delegate.hasChanges();
}
+
+ @Override
+ public int changeSize()
+ {
+ return delegate.changeSize();
+ }
}
private static final int DENSE_NODE_THRESHOLD = 5;
diff --git a/community/kernel/src/test/java/org/neo4j/kernel/impl/transaction/state/TransactionRecordStateTest.java b/community/kernel/src/test/java/org/neo4j/kernel/impl/transaction/state/TransactionRecordStateTest.java
index 597bf08b880a5..64be54bda80c3 100644
--- a/community/kernel/src/test/java/org/neo4j/kernel/impl/transaction/state/TransactionRecordStateTest.java
+++ b/community/kernel/src/test/java/org/neo4j/kernel/impl/transaction/state/TransactionRecordStateTest.java
@@ -43,12 +43,11 @@
import org.neo4j.kernel.impl.api.BatchTransactionApplier;
import org.neo4j.kernel.impl.api.CommandVisitor;
import org.neo4j.kernel.impl.api.TransactionToApply;
-import org.neo4j.kernel.impl.api.index.IndexingService;
import org.neo4j.kernel.impl.api.index.NodePropertyCommandsExtractor;
import org.neo4j.kernel.impl.core.CacheAccessBackDoor;
import org.neo4j.kernel.impl.locking.Lock;
import org.neo4j.kernel.impl.locking.LockService;
-import org.neo4j.kernel.impl.locking.Locks;
+import org.neo4j.kernel.impl.locking.NoOpClient;
import org.neo4j.kernel.impl.storageengine.impl.recordstorage.RecordStorageCommandReaderFactory;
import org.neo4j.kernel.impl.store.NeoStores;
import org.neo4j.kernel.impl.store.NodeStore;
@@ -77,6 +76,7 @@
import org.neo4j.kernel.impl.transaction.log.entry.LogEntryReader;
import org.neo4j.kernel.impl.transaction.log.entry.LogEntryWriter;
import org.neo4j.kernel.impl.transaction.log.entry.VersionAwareLogEntryReader;
+import org.neo4j.kernel.impl.transaction.state.RecordAccess.RecordProxy;
import org.neo4j.storageengine.api.StorageCommand;
import org.neo4j.storageengine.api.schema.SchemaRule;
import org.neo4j.test.NeoStoresRule;
@@ -111,48 +111,69 @@ public class TransactionRecordStateTest
{
private static final String LONG_STRING = "string value long enough not to be stored as a short string";
- public static void assertRelationshipGroupDoesNotExist( NeoStoreTransactionContext txCtx, NodeRecord node,
+ public static void assertRelationshipGroupDoesNotExist( RecordChangeSet recordChangeSet, NodeRecord node,
int type )
{
- assertNull( txCtx.getRelationshipGroup( node, type ) );
+ assertNull( getRelationshipGroup( recordChangeSet, node, type ) );
}
- public static void assertDenseRelationshipCounts( TransactionRecordState tx, NeoStoreTransactionContext txCtx,
+ public static void assertDenseRelationshipCounts( RecordChangeSet recordChangeSet,
long nodeId, int type, int outCount, int inCount )
{
- RelationshipGroupRecord group = txCtx.getRelationshipGroup(
- txCtx.getNodeRecords().getOrLoad( nodeId, null ).forReadingData(), type ).forReadingData();
+ RelationshipGroupRecord group = getRelationshipGroup( recordChangeSet,
+ recordChangeSet.getNodeRecords().getOrLoad( nodeId, null ).forReadingData(), type ).forReadingData();
assertNotNull( group );
RelationshipRecord rel;
long relId = group.getFirstOut();
if ( relId != Record.NO_NEXT_RELATIONSHIP.intValue() )
{
- rel = txCtx.getRelRecords().getOrLoad( relId, null ).forReadingData();
+ rel = recordChangeSet.getRelRecords().getOrLoad( relId, null ).forReadingData();
// count is stored in the back pointer of the first relationship in the chain
assertEquals( "Stored relationship count for OUTGOING differs", outCount, rel.getFirstPrevRel() );
assertEquals( "Manually counted relationships for OUTGOING differs", outCount,
- manuallyCountRelationships( txCtx, nodeId, relId ) );
+ manuallyCountRelationships( recordChangeSet, nodeId, relId ) );
}
relId = group.getFirstIn();
if ( relId != Record.NO_NEXT_RELATIONSHIP.intValue() )
{
- rel = txCtx.getRelRecords().getOrLoad( relId, null ).forReadingData();
+ rel = recordChangeSet.getRelRecords().getOrLoad( relId, null ).forReadingData();
assertEquals( "Stored relationship count for INCOMING differs", inCount, rel.getSecondPrevRel() );
assertEquals( "Manually counted relationships for INCOMING differs", inCount,
- manuallyCountRelationships( txCtx, nodeId, relId ) );
+ manuallyCountRelationships( recordChangeSet, nodeId, relId ) );
}
}
- private static int manuallyCountRelationships( NeoStoreTransactionContext txCtx, long nodeId, long firstRelId )
+ private static RecordProxy getRelationshipGroup(
+ RecordChangeSet recordChangeSet, NodeRecord node, int type )
+ {
+ long groupId = node.getNextRel();
+ long previousGroupId = Record.NO_NEXT_RELATIONSHIP.intValue();
+ while ( groupId != Record.NO_NEXT_RELATIONSHIP.intValue() )
+ {
+ RecordProxy change =
+ recordChangeSet.getRelGroupRecords().getOrLoad( groupId, type );
+ RelationshipGroupRecord record = change.forReadingData();
+ record.setPrev( previousGroupId ); // not persistent so not a "change"
+ if ( record.getType() == type )
+ {
+ return change;
+ }
+ previousGroupId = groupId;
+ groupId = record.getNext();
+ }
+ return null;
+ }
+
+ private static int manuallyCountRelationships( RecordChangeSet recordChangeSet, long nodeId, long firstRelId )
{
int count = 0;
long relId = firstRelId;
while ( relId != Record.NO_NEXT_RELATIONSHIP.intValue() )
{
count++;
- RelationshipRecord record = txCtx.getRelRecords().getOrLoad( relId, null ).forReadingData();
+ RelationshipRecord record = recordChangeSet.getRelRecords().getOrLoad( relId, null ).forReadingData();
relId = record.getFirstNode() == nodeId ? record.getFirstNextRel() : record.getSecondNextRel();
}
return count;
@@ -161,29 +182,28 @@ private static int manuallyCountRelationships( NeoStoreTransactionContext txCtx,
@Rule
public final NeoStoresRule neoStoresRule = new NeoStoresRule( getClass() );
private final IntegrityValidator integrityValidator = mock( IntegrityValidator.class );
+ private RecordChangeSet recordChangeSet;
@Test
- @SuppressWarnings( "unchecked" )
public void shouldCreateEqualNodePropertyUpdatesOnRecoveryOfCreatedNode() throws Exception
{
/* There was an issue where recovering a tx where a node with a label and a property
* was created resulted in two exact copies of NodePropertyUpdates. */
// GIVEN
+ NeoStores neoStores = neoStoresRule.open();
long nodeId = 0;
int labelId = 5, propertyKeyId = 7;
// -- an index
long ruleId = 0;
- NeoStores neoStores = neoStoresRule.open();
- TransactionRecordState recordState = new TransactionRecordState( neoStores, integrityValidator,
- newContext( neoStores ) );
+ TransactionRecordState recordState = newTransactionRecordState( neoStores );
SchemaRule rule = indexRule( ruleId, labelId, propertyKeyId, PROVIDER_DESCRIPTOR );
recordState.createSchemaRule( rule );
apply( neoStores, recordState );
// -- and a tx creating a node with that label and property key
- recordState = new TransactionRecordState( neoStores, integrityValidator, newContext( neoStores ) );
+ recordState = newTransactionRecordState( neoStores );
recordState.nodeCreate( nodeId );
recordState.addLabelToNode( labelId, nodeId );
recordState.nodeAddProperty( nodeId, propertyKeyId, "Neo" );
@@ -223,8 +243,7 @@ public void shouldWriteProperPropertyRecordsWhenOnlyChangingLinkage() throws Exc
// GIVEN
NeoStores neoStores = neoStoresRule.open();
- TransactionRecordState recordState = new TransactionRecordState( neoStores, integrityValidator,
- newContext( neoStores ) );
+ TransactionRecordState recordState = newTransactionRecordState( neoStores );
int nodeId = 0;
recordState.nodeCreate( nodeId );
int index = 0;
@@ -232,7 +251,7 @@ public void shouldWriteProperPropertyRecordsWhenOnlyChangingLinkage() throws Exc
apply( neoStores, recordState );
// WHEN
- recordState = new TransactionRecordState( neoStores, integrityValidator, newContext( neoStores ) );
+ recordState = newTransactionRecordState( neoStores );
int index2 = 1;
recordState.nodeAddProperty( nodeId, index2, string( 40 ) ); // will require a block of size 4
@@ -266,10 +285,9 @@ private void verifyPropertyRecord( PropertyRecord record )
public void shouldConvertLabelAdditionToNodePropertyUpdates() throws Exception
{
// GIVEN
- long nodeId = 0;
NeoStores neoStores = neoStoresRule.open();
- TransactionRecordState recordState = new TransactionRecordState( neoStores, integrityValidator,
- newContext( neoStores ) );
+ long nodeId = 0;
+ TransactionRecordState recordState = newTransactionRecordState( neoStores );
int propertyKey1 = 1, propertyKey2 = 2, labelId = 3;
long[] labelIds = new long[]{labelId};
Object value1 = LONG_STRING, value2 = LONG_STRING.getBytes();
@@ -279,7 +297,7 @@ public void shouldConvertLabelAdditionToNodePropertyUpdates() throws Exception
apply( neoStores, recordState );
// WHEN
- recordState = new TransactionRecordState( neoStores, integrityValidator, newContext( neoStores ) );
+ recordState = newTransactionRecordState( neoStores );
recordState.addLabelToNode( labelId, nodeId );
Iterable indexUpdates = indexUpdatesOf( neoStores, recordState );
@@ -294,10 +312,9 @@ public void shouldConvertLabelAdditionToNodePropertyUpdates() throws Exception
public void shouldConvertMixedLabelAdditionAndSetPropertyToNodePropertyUpdates() throws Exception
{
// GIVEN
- long nodeId = 0;
NeoStores neoStores = neoStoresRule.open();
- TransactionRecordState recordState = new TransactionRecordState( neoStores, integrityValidator,
- newContext( neoStores ) );
+ long nodeId = 0;
+ TransactionRecordState recordState = newTransactionRecordState( neoStores );
int propertyKey1 = 1, propertyKey2 = 2, labelId1 = 3, labelId2 = 4;
Object value1 = "first", value2 = 4;
recordState.nodeCreate( nodeId );
@@ -306,7 +323,7 @@ public void shouldConvertMixedLabelAdditionAndSetPropertyToNodePropertyUpdates()
apply( neoStores, recordState );
// WHEN
- recordState = new TransactionRecordState( neoStores, integrityValidator, newContext( neoStores ) );
+ recordState = newTransactionRecordState( neoStores );
recordState.nodeAddProperty( nodeId, propertyKey2, value2 );
recordState.addLabelToNode( labelId2, nodeId );
Iterable indexUpdates = indexUpdatesOf( neoStores, recordState );
@@ -321,10 +338,9 @@ public void shouldConvertMixedLabelAdditionAndSetPropertyToNodePropertyUpdates()
public void shouldConvertLabelRemovalToNodePropertyUpdates() throws Exception
{
// GIVEN
- long nodeId = 0;
NeoStores neoStores = neoStoresRule.open();
- TransactionRecordState recordState = new TransactionRecordState( neoStores, integrityValidator,
- newContext( neoStores ) );
+ long nodeId = 0;
+ TransactionRecordState recordState = newTransactionRecordState( neoStores );
int propertyKey1 = 1, propertyKey2 = 2, labelId = 3;
long[] labelIds = new long[]{labelId};
Object value1 = "first", value2 = 4;
@@ -335,7 +351,7 @@ public void shouldConvertLabelRemovalToNodePropertyUpdates() throws Exception
apply( neoStores, recordState );
// WHEN
- recordState = new TransactionRecordState( neoStores, integrityValidator, newContext( neoStores ) );
+ recordState = newTransactionRecordState( neoStores );
recordState.removeLabelFromNode( labelId, nodeId );
Iterable indexUpdates = indexUpdatesOf( neoStores, recordState );
@@ -350,10 +366,9 @@ public void shouldConvertLabelRemovalToNodePropertyUpdates() throws Exception
public void shouldConvertMixedLabelRemovalAndRemovePropertyToNodePropertyUpdates() throws Exception
{
// GIVEN
- long nodeId = 0;
NeoStores neoStores = neoStoresRule.open();
- TransactionRecordState recordState = new TransactionRecordState( neoStores, integrityValidator,
- newContext( neoStores ) );
+ long nodeId = 0;
+ TransactionRecordState recordState = newTransactionRecordState( neoStores );
int propertyKey1 = 1, propertyKey2 = 2, labelId1 = 3, labelId2 = 4;
Object value1 = "first", value2 = 4;
recordState.nodeCreate( nodeId );
@@ -364,7 +379,7 @@ public void shouldConvertMixedLabelRemovalAndRemovePropertyToNodePropertyUpdates
apply( neoStores, recordState );
// WHEN
- recordState = new TransactionRecordState( neoStores, integrityValidator, newContext( neoStores ) );
+ recordState = newTransactionRecordState( neoStores );
recordState.nodeRemoveProperty( nodeId, property1.propertyKeyId() );
recordState.removeLabelFromNode( labelId2, nodeId );
Iterable indexUpdates = indexUpdatesOf( neoStores, recordState );
@@ -380,10 +395,9 @@ public void shouldConvertMixedLabelRemovalAndRemovePropertyToNodePropertyUpdates
public void shouldConvertMixedLabelRemovalAndAddPropertyToNodePropertyUpdates() throws Exception
{
// GIVEN
- long nodeId = 0;
NeoStores neoStores = neoStoresRule.open();
- TransactionRecordState recordState = new TransactionRecordState( neoStores, integrityValidator,
- newContext( neoStores ) );
+ long nodeId = 0;
+ TransactionRecordState recordState = newTransactionRecordState( neoStores );
int propertyKey1 = 1, propertyKey2 = 2, labelId1 = 3, labelId2 = 4;
Object value1 = "first", value2 = 4;
recordState.nodeCreate( nodeId );
@@ -393,7 +407,7 @@ public void shouldConvertMixedLabelRemovalAndAddPropertyToNodePropertyUpdates()
apply( neoStores, recordState );
// WHEN
- recordState = new TransactionRecordState( neoStores, integrityValidator, newContext( neoStores ) );
+ recordState = newTransactionRecordState( neoStores );
recordState.nodeAddProperty( nodeId, propertyKey2, value2 );
recordState.removeLabelFromNode( labelId2, nodeId );
Iterable indexUpdates = indexUpdatesOf( neoStores, recordState );
@@ -410,10 +424,9 @@ public void shouldConvertMixedLabelRemovalAndAddPropertyToNodePropertyUpdates()
public void shouldConvertChangedPropertyToNodePropertyUpdates() throws Exception
{
// GIVEN
- int nodeId = 0;
NeoStores neoStores = neoStoresRule.open();
- TransactionRecordState recordState = new TransactionRecordState( neoStores, integrityValidator,
- newContext( neoStores ) );
+ int nodeId = 0;
+ TransactionRecordState recordState = newTransactionRecordState( neoStores );
int propertyKey1 = 1, propertyKey2 = 2;
Object value1 = "first", value2 = 4;
recordState.nodeCreate( nodeId );
@@ -423,7 +436,7 @@ public void shouldConvertChangedPropertyToNodePropertyUpdates() throws Exception
// WHEN
Object newValue1 = "new", newValue2 = "new 2";
- recordState = new TransactionRecordState( neoStores, integrityValidator, newContext( neoStores ) );
+ recordState = newTransactionRecordState( neoStores );
recordState.nodeChangeProperty( nodeId, property1.propertyKeyId(), newValue1 );
recordState.nodeChangeProperty( nodeId, property2.propertyKeyId(), newValue2 );
Iterable indexUpdates = indexUpdatesOf( neoStores, recordState );
@@ -439,10 +452,9 @@ public void shouldConvertChangedPropertyToNodePropertyUpdates() throws Exception
public void shouldConvertRemovedPropertyToNodePropertyUpdates() throws Exception
{
// GIVEN
- int nodeId = 0;
NeoStores neoStores = neoStoresRule.open();
- TransactionRecordState recordState = new TransactionRecordState( neoStores, integrityValidator,
- newContext( neoStores ) );
+ int nodeId = 0;
+ TransactionRecordState recordState = newTransactionRecordState( neoStores );
int propertyKey1 = 1, propertyKey2 = 2;
int labelId = 3;
Object value1 = "first", value2 = 4;
@@ -453,7 +465,7 @@ public void shouldConvertRemovedPropertyToNodePropertyUpdates() throws Exception
apply( neoStores, transactionRepresentationOf( recordState ) );
// WHEN
- recordState = new TransactionRecordState( neoStores, integrityValidator, newContext( neoStores ) );
+ recordState = newTransactionRecordState( neoStores );
recordState.nodeRemoveProperty( nodeId, property1.propertyKeyId() );
recordState.nodeRemoveProperty( nodeId, property2.propertyKeyId() );
Iterable indexUpdates = indexUpdatesOf( neoStores, recordState );
@@ -511,8 +523,7 @@ public void shouldExtractCreatedCommandsInCorrectOrder() throws Throwable
{
// GIVEN
NeoStores neoStores = neoStoresRule.open( GraphDatabaseSettings.dense_node_threshold.name(), "1" );
- TransactionRecordState recordState = new TransactionRecordState( neoStores, integrityValidator,
- newContext( neoStores ) );
+ TransactionRecordState recordState = newTransactionRecordState( neoStores );
long nodeId = 0, relId = 1;
recordState.nodeCreate( nodeId );
recordState.relCreate( relId++, 0, nodeId, nodeId );
@@ -539,8 +550,7 @@ public void shouldExtractUpdateCommandsInCorrectOrder() throws Throwable
{
// GIVEN
NeoStores neoStores = neoStoresRule.open( GraphDatabaseSettings.dense_node_threshold.name(), "1" );
- TransactionRecordState recordState = new TransactionRecordState( neoStores, integrityValidator,
- newContext( neoStores ) );
+ TransactionRecordState recordState = newTransactionRecordState( neoStores );
long nodeId = 0, relId1 = 1, relId2 = 2, relId3 = 3;
recordState.nodeCreate( nodeId );
recordState.relCreate( relId1, 0, nodeId, nodeId );
@@ -550,8 +560,7 @@ public void shouldExtractUpdateCommandsInCorrectOrder() throws Throwable
LockService.NO_LOCK_SERVICE );
apply( applier, transaction( recordState ) );
- recordState = new TransactionRecordState( neoStores, mock( IntegrityValidator.class ),
- newContext( neoStores ) );
+ recordState = newTransactionRecordState( neoStores );
recordState.nodeChangeProperty( nodeId, 0, 102 );
recordState.relCreate( relId3, 0, nodeId, nodeId );
recordState.relAddProperty( relId1, 0, 123 );
@@ -581,8 +590,7 @@ public void shouldExtractDeleteCommandsInCorrectOrder() throws Throwable
{
// GIVEN
NeoStores neoStores = neoStoresRule.open( GraphDatabaseSettings.dense_node_threshold.name(), "1" );
- TransactionRecordState recordState = new TransactionRecordState( neoStores, integrityValidator,
- newContext( neoStores ) );
+ TransactionRecordState recordState = newTransactionRecordState( neoStores );
long nodeId1 = 0, nodeId2 = 1, relId1 = 1, relId2 = 2, relId4 = 10;
recordState.nodeCreate( nodeId1 );
recordState.nodeCreate( nodeId2 );
@@ -594,8 +602,7 @@ public void shouldExtractDeleteCommandsInCorrectOrder() throws Throwable
LockService.NO_LOCK_SERVICE );
apply( applier, transaction( recordState ) );
- recordState = new TransactionRecordState( neoStores, mock( IntegrityValidator.class ),
- newContext( neoStores ) );
+ recordState = newTransactionRecordState( neoStores );
recordState.relDelete( relId4 );
recordState.nodeDelete( nodeId2 );
recordState.nodeRemoveProperty( nodeId1, 0 );
@@ -624,8 +631,7 @@ public void shouldValidateConstraintIndexAsPartOfExtraction() throws Throwable
{
// GIVEN
NeoStores neoStores = neoStoresRule.open();
- TransactionRecordState recordState = new TransactionRecordState( neoStores, integrityValidator,
- newContext( neoStores ) );
+ TransactionRecordState recordState = newTransactionRecordState( neoStores );
final long indexId = neoStores.getSchemaStore().nextId();
final long constraintId = neoStores.getSchemaStore().nextId();
@@ -644,8 +650,7 @@ public void shouldCreateProperBeforeAndAfterPropertyCommandsWhenAddingProperty()
{
// GIVEN
NeoStores neoStores = neoStoresRule.open();
- TransactionRecordState recordState = new TransactionRecordState( neoStores, integrityValidator,
- newContext( neoStores ) );
+ TransactionRecordState recordState = newTransactionRecordState( neoStores );
int nodeId = 1;
recordState.nodeCreate( nodeId );
@@ -672,10 +677,9 @@ public void shouldCreateProperBeforeAndAfterPropertyCommandsWhenAddingProperty()
public void shouldConvertAddedPropertyToNodePropertyUpdates() throws Exception
{
// GIVEN
- long nodeId = 0;
NeoStores neoStores = neoStoresRule.open();
- TransactionRecordState recordState = new TransactionRecordState( neoStores, integrityValidator,
- newContext( neoStores ) );
+ long nodeId = 0;
+ TransactionRecordState recordState = newTransactionRecordState( neoStores );
int labelId = 3;
int propertyKey1 = 1, propertyKey2 = 2;
Object value1 = "first", value2 = 4;
@@ -696,7 +700,7 @@ public void shouldConvertAddedPropertyToNodePropertyUpdates() throws Exception
public void shouldLockUpdatedNodes() throws Exception
{
// given
- LockService locks = mock( LockService.class, new Answer()
+ LockService locks = mock( LockService.class, new Answer