use of org.neo4j.kernel.api.properties.DefinedProperty in project neo4j by neo4j.
the class IndexTxStateUpdater method getOrderedPropertyValues.
private OrderedPropertyValues getOrderedPropertyValues(KernelStatement state, NodeItem node, DefinedProperty changedProperty, int[] indexPropertyIds) {
DefinedProperty[] values = new DefinedProperty[indexPropertyIds.length];
Cursor<PropertyItem> propertyCursor = readOps.nodeGetProperties(state, node);
while (propertyCursor.next()) {
PropertyItem property = propertyCursor.get();
int k = ArrayUtils.indexOf(indexPropertyIds, property.propertyKeyId());
if (k >= 0) {
values[k] = indexPropertyIds[k] == changedProperty.propertyKeyId() ? changedProperty : Property.property(indexPropertyIds[k], property.value());
}
}
if (changedProperty != NO_SUCH_PROPERTY) {
int k = ArrayUtils.indexOf(indexPropertyIds, changedProperty.propertyKeyId());
if (k >= 0) {
values[k] = changedProperty;
}
}
return OrderedPropertyValues.of(values);
}
use of org.neo4j.kernel.api.properties.DefinedProperty in project neo4j by neo4j.
the class LockingStatementOperationsTest method shouldNotAcquireEntityWriteLockBeforeSettingPropertyOnJustCreatedNode.
@Test
public void shouldNotAcquireEntityWriteLockBeforeSettingPropertyOnJustCreatedNode() throws Exception {
// given
txState.nodeDoCreate(123);
DefinedProperty property = Property.property(8, 9);
// when
lockingOps.nodeSetProperty(state, 123, property);
// then
order.verify(locks, never()).acquireExclusive(LockTracer.NONE, ResourceTypes.NODE, 123);
order.verify(entityWriteOps).nodeSetProperty(state, 123, property);
}
use of org.neo4j.kernel.api.properties.DefinedProperty in project neo4j by neo4j.
the class LockingStatementOperationsTest method shouldAcquireSchemaReadLockBeforeSettingPropertyOnNode.
@Test
public void shouldAcquireSchemaReadLockBeforeSettingPropertyOnNode() throws Exception {
// given
DefinedProperty property = Property.property(8, 9);
// when
lockingOps.nodeSetProperty(state, 123, property);
// then
order.verify(locks).acquireShared(LockTracer.NONE, ResourceTypes.SCHEMA, schemaResource());
order.verify(entityWriteOps).nodeSetProperty(state, 123, property);
}
use of org.neo4j.kernel.api.properties.DefinedProperty in project neo4j by neo4j.
the class LockingStatementOperationsTest method shouldAcquireEntityWriteLockBeforeSettingPropertyOnRelationship.
@Test
public void shouldAcquireEntityWriteLockBeforeSettingPropertyOnRelationship() throws Exception {
// given
DefinedProperty property = Property.property(8, 9);
// when
lockingOps.relationshipSetProperty(state, 123, property);
// then
order.verify(locks).acquireExclusive(LockTracer.NONE, ResourceTypes.RELATIONSHIP, 123);
order.verify(entityWriteOps).relationshipSetProperty(state, 123, property);
}
use of org.neo4j.kernel.api.properties.DefinedProperty in project neo4j by neo4j.
the class LockingStatementOperationsTest method shouldNotAcquireEntityWriteLockBeforeSettingPropertyOnJustCreatedRelationship.
@Test
public void shouldNotAcquireEntityWriteLockBeforeSettingPropertyOnJustCreatedRelationship() throws Exception {
// given
txState.relationshipDoCreate(123, 1, 2, 3);
DefinedProperty property = Property.property(8, 9);
// when
lockingOps.relationshipSetProperty(state, 123, property);
// then
order.verify(locks, never()).acquireExclusive(LockTracer.NONE, ResourceTypes.RELATIONSHIP, 123);
order.verify(entityWriteOps).relationshipSetProperty(state, 123, property);
}
Aggregations