use of org.neo4j.kernel.impl.store.allocator.ReusableRecordsCompositeAllocator in project neo4j by neo4j.
the class DynamicNodeLabels method remove.
@Override
public Collection<DynamicRecord> remove(long labelId, NodeStore nodeStore) {
nodeStore.ensureHeavy(node, firstDynamicLabelRecordId(node.getLabelField()));
long[] existingLabelIds = getDynamicLabelsArray(node.getUsedDynamicLabelRecords(), nodeStore.getDynamicLabelStore());
long[] newLabelIds = filter(existingLabelIds, labelId);
Collection<DynamicRecord> existingRecords = node.getDynamicLabelRecords();
if (InlineNodeLabels.tryInlineInNodeRecord(node, newLabelIds, existingRecords)) {
setNotInUse(existingRecords);
} else {
Collection<DynamicRecord> newRecords = allocateRecordsForDynamicLabels(node.getId(), newLabelIds, new ReusableRecordsCompositeAllocator(existingRecords, nodeStore.getDynamicLabelStore()));
node.setLabelField(dynamicPointer(newRecords), existingRecords);
if (!newRecords.equals(existingRecords)) {
// One less dynamic record, mark that one as not in use
for (DynamicRecord record : existingRecords) {
if (!newRecords.contains(record)) {
record.setInUse(false);
}
}
}
}
return existingRecords;
}
use of org.neo4j.kernel.impl.store.allocator.ReusableRecordsCompositeAllocator in project neo4j by neo4j.
the class SchemaStore method allocateFrom.
public List<DynamicRecord> allocateFrom(SchemaRule rule) {
List<DynamicRecord> records = new ArrayList<>();
DynamicRecord record = getRecord(rule.getId(), nextRecord(), CHECK);
DynamicRecordAllocator recordAllocator = new ReusableRecordsCompositeAllocator(singleton(record), this);
allocateRecordsFromBytes(records, rule.serialize(), recordAllocator);
return records;
}
use of org.neo4j.kernel.impl.store.allocator.ReusableRecordsCompositeAllocator in project neo4j by neo4j.
the class DynamicNodeLabels method remove.
@Override
public Collection<DynamicRecord> remove(long labelId, NodeStore nodeStore, CursorContext cursorContext, MemoryTracker memoryTracker) {
nodeStore.ensureHeavy(node, firstDynamicLabelRecordId(node.getLabelField()), cursorContext);
long[] existingLabelIds = getDynamicLabelsArray(node.getUsedDynamicLabelRecords(), nodeStore.getDynamicLabelStore(), cursorContext);
long[] newLabelIds = filter(existingLabelIds, labelId);
Collection<DynamicRecord> existingRecords = node.getDynamicLabelRecords();
if (InlineNodeLabels.tryInlineInNodeRecord(node, newLabelIds, existingRecords)) {
setNotInUse(existingRecords);
} else {
Collection<DynamicRecord> newRecords = allocateRecordsForDynamicLabels(node.getId(), newLabelIds, new ReusableRecordsCompositeAllocator(existingRecords, nodeStore.getDynamicLabelStore()), cursorContext, memoryTracker);
node.setLabelField(dynamicPointer(newRecords), existingRecords);
if (!newRecords.equals(existingRecords)) {
// One less dynamic record, mark that one as not in use
for (DynamicRecord record : existingRecords) {
if (!newRecords.contains(record)) {
record.setInUse(false);
}
}
}
}
return existingRecords;
}
use of org.neo4j.kernel.impl.store.allocator.ReusableRecordsCompositeAllocator in project neo4j by neo4j.
the class RecordStorageMigratorIT method allocateFrom.
public static List<DynamicRecord> allocateFrom(SchemaStore35 schemaStore35, SchemaRule rule, CursorContext cursorContext) {
List<DynamicRecord> records = new ArrayList<>();
DynamicRecord record = schemaStore35.getRecord(rule.getId(), schemaStore35.newRecord(), CHECK, cursorContext);
DynamicRecordAllocator recordAllocator = new ReusableRecordsCompositeAllocator(singleton(record), schemaStore35);
allocateRecordsFromBytes(records, SchemaRuleSerialization35.serialize(rule, INSTANCE), recordAllocator, cursorContext, INSTANCE);
return records;
}
Aggregations