use of org.neo4j.kernel.impl.store.record.DynamicRecord in project neo4j by neo4j.
the class PhysicalLogCommandReaderV2_2_4 method visitSchemaRuleCommand.
private Command visitSchemaRuleCommand(ReadableChannel channel) throws IOException {
Collection<DynamicRecord> recordsBefore = new ArrayList<>();
readDynamicRecords(channel, recordsBefore, COLLECTION_DYNAMIC_RECORD_ADDER);
Collection<DynamicRecord> recordsAfter = new ArrayList<>();
readDynamicRecords(channel, recordsAfter, COLLECTION_DYNAMIC_RECORD_ADDER);
byte isCreated = channel.get();
if (1 == isCreated) {
for (DynamicRecord record : recordsAfter) {
record.setCreated();
}
}
SchemaRule rule = Iterables.first(recordsAfter).inUse() ? readSchemaRule(recordsAfter) : readSchemaRule(recordsBefore);
return new Command.SchemaRuleCommand(recordsBefore, recordsAfter, rule);
}
use of org.neo4j.kernel.impl.store.record.DynamicRecord in project neo4j by neo4j.
the class PhysicalLogCommandReaderV3_0 method visitSchemaRuleCommand.
private Command visitSchemaRuleCommand(ReadableChannel channel) throws IOException {
Collection<DynamicRecord> recordsBefore = new ArrayList<>();
readDynamicRecords(channel, recordsBefore, COLLECTION_DYNAMIC_RECORD_ADDER);
Collection<DynamicRecord> recordsAfter = new ArrayList<>();
readDynamicRecords(channel, recordsAfter, COLLECTION_DYNAMIC_RECORD_ADDER);
byte isCreated = channel.get();
if (1 == isCreated) {
for (DynamicRecord record : recordsAfter) {
record.setCreated();
}
}
SchemaRule rule = Iterables.first(recordsAfter).inUse() ? readSchemaRule(recordsAfter) : readSchemaRule(recordsBefore);
return new Command.SchemaRuleCommand(recordsBefore, recordsAfter, rule);
}
use of org.neo4j.kernel.impl.store.record.DynamicRecord 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.DynamicRecord in project neo4j by neo4j.
the class PhysicalLogCommandReaderV3_0 method readDynamicRecords.
private <T> int readDynamicRecords(ReadableChannel channel, T target, DynamicRecordAdder<T> adder) throws IOException {
int numberOfRecords = channel.getInt();
assert numberOfRecords >= 0;
while (numberOfRecords > 0) {
DynamicRecord read = readDynamicRecord(channel);
if (read == null) {
return -1;
}
adder.add(target, read);
numberOfRecords--;
}
return numberOfRecords;
}
use of org.neo4j.kernel.impl.store.record.DynamicRecord in project neo4j by neo4j.
the class NodeStoreTest method shouldMarkRecordHeavyWhenSettingLabelFieldWithDynamicRecords.
@Test
public void shouldMarkRecordHeavyWhenSettingLabelFieldWithDynamicRecords() throws Exception {
// GIVEN
NodeRecord record = new NodeRecord(0, false, NO_NEXT_RELATIONSHIP.intValue(), NO_NEXT_PROPERTY.intValue());
// WHEN
DynamicRecord dynamicRecord = new DynamicRecord(1);
record.setLabelField(0x8000000001L, asList(dynamicRecord));
// THEN
assertFalse(record.isLight());
}
Aggregations