Exemple #1
0
 private void RemoveProperty(PrimitiveRecord primitive, PropertyRecord host, PropertyBlock block)
 {
     host.RemovePropertyBlock(block.KeyIndexId);
     host.Changed = primitive;
     foreach (DynamicRecord record in block.ValueRecords)
     {
         Debug.Assert(record.InUse());
         record.SetInUse(false, block.Type.intValue());
         host.AddDeletedRecord(record);
     }
 }
Exemple #2
0
        private void RemoveProperty <P>(RecordAccess_RecordProxy <P, Void> primitiveProxy, int propertyKey, RecordAccess <PropertyRecord, PrimitiveRecord> propertyRecords, PrimitiveRecord primitive, long propertyId) where P : Org.Neo4j.Kernel.impl.store.record.PrimitiveRecord
        {
            RecordAccess_RecordProxy <PropertyRecord, PrimitiveRecord> recordChange = propertyRecords.GetOrLoad(propertyId, primitive);
            PropertyRecord propRecord = recordChange.ForChangingData();

            if (!propRecord.InUse())
            {
                throw new System.InvalidOperationException("Unable to delete property[" + propertyId + "] since it is already deleted.");
            }

            PropertyBlock block = propRecord.RemovePropertyBlock(propertyKey);

            if (block == null)
            {
                throw new System.InvalidOperationException("Property with index[" + propertyKey + "] is not present in property[" + propertyId + "]");
            }

            foreach (DynamicRecord valueRecord in block.ValueRecords)
            {
                Debug.Assert(valueRecord.InUse());
                valueRecord.SetInUse(false, block.Type.intValue());
                propRecord.AddDeletedRecord(valueRecord);
            }
            if (propRecord.Size() > 0)
            {
                /*
                 * There are remaining blocks in the record. We do not unlink yet.
                 */
                propRecord.Changed = primitive;
                Debug.Assert(_traverser.assertPropertyChain(primitive, propertyRecords));
            }
            else
            {
                UnlinkPropertyRecord(propRecord, propertyRecords, primitiveProxy);
            }
        }