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;
}
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));
}
}
}
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);
}
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();
}
}
}
}
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();
}
}
Aggregations