Search in sources :

Example 71 with NodeRecord

use of org.neo4j.kernel.impl.store.record.NodeRecord in project neo4j by neo4j.

the class PhysicalLogicalTransactionStoreTest method singleCreateNodeCommand.

private Collection<StorageCommand> singleCreateNodeCommand() {
    Collection<StorageCommand> commands = new ArrayList<>();
    long id = 0;
    NodeRecord before = new NodeRecord(id);
    NodeRecord after = new NodeRecord(id);
    after.setInUse(true);
    commands.add(new Command.NodeCommand(before, after));
    return commands;
}
Also used : NodeRecord(org.neo4j.kernel.impl.store.record.NodeRecord) StorageCommand(org.neo4j.storageengine.api.StorageCommand) Command(org.neo4j.kernel.impl.transaction.command.Command) StorageCommand(org.neo4j.storageengine.api.StorageCommand) ArrayList(java.util.ArrayList)

Example 72 with NodeRecord

use of org.neo4j.kernel.impl.store.record.NodeRecord in project neo4j by neo4j.

the class DeleteDuplicateNodesStep method process.

@Override
protected void process() throws IOException {
    NodeRecord record = nodeStore.newRecord();
    RecordCursor<NodeRecord> cursor = nodeStore.newRecordCursor(record).acquire(0, NORMAL);
    while (nodeIds.hasNext()) {
        long duplicateNodeId = nodeIds.next();
        cursor.next(duplicateNodeId);
        long[] labels = NodeLabelsField.get(record, nodeStore);
        record.setInUse(false);
        nodeStore.updateRecord(record);
        if (labels.length > 0) {
            labelScanWriter.write(labelChanges(duplicateNodeId, labels, EMPTY_LONG_ARRAY));
        }
    }
}
Also used : NodeRecord(org.neo4j.kernel.impl.store.record.NodeRecord)

Example 73 with NodeRecord

use of org.neo4j.kernel.impl.store.record.NodeRecord in project neo4j by neo4j.

the class LabelScanStorePopulationStep method process.

@Override
protected void process(Batch<InputNode, NodeRecord> batch, BatchSender sender) throws Throwable {
    int length = batch.labels.length;
    for (int i = 0; i < length; i++) {
        long[] labels = batch.labels[i];
        NodeRecord node = batch.records[i];
        if (labels != null && node.inUse()) {
            writer.write(labelChanges(node.getId(), EMPTY_LONG_ARRAY, labels));
        }
    }
    sender.send(batch);
}
Also used : NodeRecord(org.neo4j.kernel.impl.store.record.NodeRecord)

Example 74 with NodeRecord

use of org.neo4j.kernel.impl.store.record.NodeRecord in project neo4j by neo4j.

the class NodeSetFirstGroupStep method process.

@Override
protected void process(RelationshipGroupRecord[] batch, BatchSender sender) throws Throwable {
    for (RelationshipGroupRecord group : batch) {
        assert group.inUse();
        long nodeId = group.getOwningNode();
        if (cache.getByte(nodeId, 0) == 0) {
            cache.setByte(nodeId, 0, (byte) 1);
            nodeRecordCursor.next(nodeId);
            NodeRecord node = nodeRecordCursor.get().clone();
            node.setNextRel(group.getId());
            current[cursor++] = node;
            if (cursor == batchSize) {
                sender.send(current);
                newBatch();
            }
        }
    }
}
Also used : NodeRecord(org.neo4j.kernel.impl.store.record.NodeRecord) RelationshipGroupRecord(org.neo4j.kernel.impl.store.record.RelationshipGroupRecord)

Example 75 with NodeRecord

use of org.neo4j.kernel.impl.store.record.NodeRecord in project neo4j by neo4j.

the class StorageLayerRelTypesAndDegreeTest method markRelGroupNotInUse.

private void markRelGroupNotInUse(long nodeId, TestRelType... types) {
    NodeRecord node = getNodeRecord(nodeId);
    assertTrue(node.isDense());
    Set<TestRelType> typesToRemove = asSet(types);
    long relGroupId = node.getNextRel();
    while (relGroupId != NO_NEXT_RELATIONSHIP.intValue()) {
        RelationshipGroupRecord relGroup = getRelGroupRecord(relGroupId);
        TestRelType type = relTypeForId(relGroup.getType());
        if (typesToRemove.contains(type)) {
            relGroup.setInUse(false);
            update(relGroup);
        }
        relGroupId = relGroup.getNext();
    }
}
Also used : NodeRecord(org.neo4j.kernel.impl.store.record.NodeRecord) RelationshipGroupRecord(org.neo4j.kernel.impl.store.record.RelationshipGroupRecord)

Aggregations

NodeRecord (org.neo4j.kernel.impl.store.record.NodeRecord)391 Test (org.junit.Test)154 Test (org.junit.jupiter.api.Test)108 RelationshipRecord (org.neo4j.kernel.impl.store.record.RelationshipRecord)73 ConsistencyReport (org.neo4j.consistency.report.ConsistencyReport)63 DynamicRecord (org.neo4j.kernel.impl.store.record.DynamicRecord)58 NodeLabels (org.neo4j.kernel.impl.store.NodeLabels)46 RelationshipGroupRecord (org.neo4j.kernel.impl.store.record.RelationshipGroupRecord)42 ParameterizedTest (org.junit.jupiter.params.ParameterizedTest)40 PropertyRecord (org.neo4j.kernel.impl.store.record.PropertyRecord)40 DynamicNodeLabels (org.neo4j.kernel.impl.store.DynamicNodeLabels)38 ConsistencySummaryStatistics (org.neo4j.consistency.report.ConsistencySummaryStatistics)32 ArrayList (java.util.ArrayList)30 GraphStoreFixture (org.neo4j.consistency.checking.GraphStoreFixture)30 IdGenerator (org.neo4j.consistency.checking.GraphStoreFixture.IdGenerator)30 TransactionDataBuilder (org.neo4j.consistency.checking.GraphStoreFixture.TransactionDataBuilder)30 RelationshipTypeTokenRecord (org.neo4j.kernel.impl.store.record.RelationshipTypeTokenRecord)30 NodeStore (org.neo4j.kernel.impl.store.NodeStore)28 Command (org.neo4j.kernel.impl.transaction.command.Command)27 PropertyBlock (org.neo4j.kernel.impl.store.record.PropertyBlock)17