use of org.neo4j.kernel.impl.store.record.NodeRecord in project neo4j by neo4j.
the class PhysicalLogCommandReaderV3_0 method readNodeRecord.
private NodeRecord readNodeRecord(long id, ReadableChannel channel) throws IOException {
byte flags = channel.get();
boolean inUse = bitFlag(flags, Record.IN_USE.byteValue());
boolean requiresSecondaryUnit = bitFlag(flags, Record.REQUIRE_SECONDARY_UNIT);
boolean hasSecondaryUnit = bitFlag(flags, Record.HAS_SECONDARY_UNIT);
NodeRecord record;
Collection<DynamicRecord> dynamicLabelRecords = new ArrayList<>();
long labelField = Record.NO_LABELS_FIELD.intValue();
if (inUse) {
boolean dense = channel.get() == 1;
record = new NodeRecord(id, dense, channel.getLong(), channel.getLong());
// labels
labelField = channel.getLong();
record.setRequiresSecondaryUnit(requiresSecondaryUnit);
if (hasSecondaryUnit) {
record.setSecondaryUnitId(channel.getLong());
}
} else {
record = new NodeRecord(id);
}
readDynamicRecords(channel, dynamicLabelRecords, COLLECTION_DYNAMIC_RECORD_ADDER);
record.setLabelField(labelField, dynamicLabelRecords);
record.setInUse(inUse);
return record;
}
use of org.neo4j.kernel.impl.store.record.NodeRecord in project neo4j by neo4j.
the class NodeStoreTest method shouldTellNodeInUse.
@Test
public void shouldTellNodeInUse() throws Exception {
// Given
EphemeralFileSystemAbstraction fs = efs.get();
NodeStore store = newNodeStore(fs);
long exists = store.nextId();
store.updateRecord(new NodeRecord(exists, false, 10, 20, true));
long deleted = store.nextId();
store.updateRecord(new NodeRecord(deleted, false, 10, 20, true));
store.updateRecord(new NodeRecord(deleted, false, 10, 20, false));
// When & then
assertTrue(store.isInUse(exists));
assertFalse(store.isInUse(deleted));
assertFalse(store.isInUse(nodeStore.recordFormat.getMaxId()));
}
use of org.neo4j.kernel.impl.store.record.NodeRecord in project neo4j by neo4j.
the class CommonAbstractStoreTest method insertNodeRecordAndObservePinEvent.
private long insertNodeRecordAndObservePinEvent(RecordingPageCursorTracer tracer, NodeStore store) {
long nodeId = store.nextId();
NodeRecord record = store.newRecord();
record.setId(nodeId);
record.initialize(true, NO_NEXT_PROPERTY.intValue(), false, NO_NEXT_RELATIONSHIP.intValue(), 42);
store.prepareForCommit(record);
store.updateRecord(record);
assertNotNull(tracer.tryObserve(Pin.class));
assertNull(tracer.tryObserve(Event.class));
return nodeId;
}
use of org.neo4j.kernel.impl.store.record.NodeRecord in project neo4j by neo4j.
the class FreeIdsAfterRecoveryTest method node.
private NodeRecord node(long nextId) {
NodeRecord node = new NodeRecord(nextId);
node.setInUse(true);
return node;
}
use of org.neo4j.kernel.impl.store.record.NodeRecord in project neo4j by neo4j.
the class PropertyAndNode2LabelIndexProcessor method process.
@Override
public void process(NodeRecord nodeRecord) {
reporter.forNode(nodeRecord, nodeIndexCheck);
CacheAccess.Client client = cacheAccess.client();
try (MandatoryProperties.Check<NodeRecord, ConsistencyReport.NodeConsistencyReport> mandatoryCheck = mandatoryProperties.apply(nodeRecord)) {
Iterable<PropertyRecord> properties = client.getPropertiesFromCache();
// go by unnoticed.
if (properties != null) {
for (PropertyRecord property : properties) {
reporter.forProperty(property, propertyCheck);
mandatoryCheck.receive(ChainCheck.keys(property));
}
}
}
}
Aggregations