Пример #1
0
        protected internal override void Process()
        {
            NodeRecord     nodeRecord     = _nodeStore.newRecord();
            PropertyRecord propertyRecord = _propertyStore.newRecord();

            using (PageCursor cursor = _nodeStore.openPageCursorForReading(0), PageCursor propertyCursor = _propertyStore.openPageCursorForReading(0))
            {
                while (_nodeIds.hasNext())
                {
                    long duplicateNodeId = _nodeIds.next();
                    _nodeStore.getRecordByCursor(duplicateNodeId, nodeRecord, NORMAL, cursor);
                    Debug.Assert(nodeRecord.InUse(), nodeRecord);
                    // Ensure heavy so that the dynamic label records gets loaded (and then deleted) too
                    _nodeStore.ensureHeavy(nodeRecord);

                    // Delete property records
                    long nextProp = nodeRecord.NextProp;
                    while (!Record.NULL_REFERENCE.@is(nextProp))
                    {
                        _propertyStore.getRecordByCursor(nextProp, propertyRecord, NORMAL, propertyCursor);
                        Debug.Assert(propertyRecord.InUse(), propertyRecord + " for " + nodeRecord);
                        _propertyStore.ensureHeavy(propertyRecord);
                        _propertiesRemoved += propertyRecord.NumberOfProperties();
                        nextProp            = propertyRecord.NextProp;
                        deletePropertyRecordIncludingValueRecords(propertyRecord);
                        _propertyStore.updateRecord(propertyRecord);
                    }

                    // Delete node (and dynamic label records, if any)
                    nodeRecord.InUse = false;
                    foreach (DynamicRecord labelRecord in nodeRecord.DynamicLabelRecords)
                    {
                        labelRecord.InUse = false;
                    }
                    _nodeStore.updateRecord(nodeRecord);
                    _nodesRemoved++;
                }
            }
        }