use of org.neo4j.kernel.impl.store.allocator.ReusableRecordsAllocator in project neo4j by neo4j.
the class FullCheckIntegrationTest method serializeRule.
public static Collection<DynamicRecord> serializeRule(SchemaRule rule, Collection<DynamicRecord> records) {
byte[] data = rule.serialize();
ReusableRecordsAllocator dynamicRecordAllocator = new ReusableRecordsAllocator(data.length, records);
Collection<DynamicRecord> result = new ArrayList<>();
AbstractDynamicStore.allocateRecordsFromBytes(result, data, dynamicRecordAllocator);
return result;
}
use of org.neo4j.kernel.impl.store.allocator.ReusableRecordsAllocator in project neo4j by neo4j.
the class FullCheckIntegrationTest method shouldReportOrphanedNodeDynamicLabelAsNodeInconsistency.
@Test
public void shouldReportOrphanedNodeDynamicLabelAsNodeInconsistency() throws Exception {
// given
fixture.apply(new GraphStoreFixture.Transaction() {
@Override
protected void transactionData(GraphStoreFixture.TransactionDataBuilder tx, GraphStoreFixture.IdGenerator next) {
tx.nodeLabel(42, "Label");
NodeRecord nodeRecord = new NodeRecord(next.node(), false, -1, -1);
DynamicRecord record = inUse(new DynamicRecord(next.nodeLabel()));
Collection<DynamicRecord> newRecords = new ArrayList<>();
allocateFromNumbers(newRecords, prependNodeId(next.node(), new long[] { 42L }), new ReusableRecordsAllocator(60, record));
nodeRecord.setLabelField(dynamicPointer(newRecords), newRecords);
tx.create(nodeRecord);
}
});
// when
ConsistencySummaryStatistics stats = check();
// then
on(stats).verify(RecordType.NODE_DYNAMIC_LABEL, 1).andThatsAllFolks();
}
use of org.neo4j.kernel.impl.store.allocator.ReusableRecordsAllocator in project neo4j by neo4j.
the class NodeDynamicLabelOrphanChainStartCheckTest method shouldReportMissingOwnerId.
@Test
public void shouldReportMissingOwnerId() throws Exception {
// given
DynamicRecord record = new DynamicRecord(0);
inUse(record);
allocateFromNumbers(new ArrayList<>(), new long[] {}, new ReusableRecordsAllocator(66, record));
// when
DynamicLabelConsistencyReport report = check(record);
// then
verify(report).orphanDynamicLabelRecord();
}
use of org.neo4j.kernel.impl.store.allocator.ReusableRecordsAllocator in project neo4j by neo4j.
the class NodeDynamicLabelOrphanChainStartCheckTest method shouldReportOwningNodeRecordNotInUse.
@Test
public void shouldReportOwningNodeRecordNotInUse() throws Exception {
// given
NodeRecord nodeRecord = notInUse(new NodeRecord(12L, false, -1, -1));
add(nodeRecord);
DynamicRecord nodeDynamicLabelRecord = inUse(new DynamicRecord(0));
allocateFromNumbers(new ArrayList<>(), new long[] { 12L }, new ReusableRecordsAllocator(66, nodeDynamicLabelRecord));
// when
DynamicLabelConsistencyReport report = check(nodeDynamicLabelRecord);
// then
verify(report).orphanDynamicLabelRecordDueToInvalidOwner(nodeRecord);
}
use of org.neo4j.kernel.impl.store.allocator.ReusableRecordsAllocator in project neo4j by neo4j.
the class NodeRecordCheckTest method shouldReportDuplicateDynamicLabels.
@Test
public void shouldReportDuplicateDynamicLabels() throws Exception {
// given
long[] labelIds = createLabels(100);
NodeRecord node = inUse(new NodeRecord(42, false, NONE, NONE));
add(node);
DynamicRecord labelsRecord1 = inUse(array(new DynamicRecord(1)));
DynamicRecord labelsRecord2 = inUse(array(new DynamicRecord(2)));
Collection<DynamicRecord> labelRecords = asList(labelsRecord1, labelsRecord2);
labelIds[12] = 11;
DynamicArrayStore.allocateFromNumbers(new ArrayList<>(), labelIds, new ReusableRecordsAllocator(52, labelRecords));
assertDynamicRecordChain(labelsRecord1, labelsRecord2);
node.setLabelField(DynamicNodeLabels.dynamicPointer(labelRecords), labelRecords);
addNodeDynamicLabels(labelsRecord1);
addNodeDynamicLabels(labelsRecord2);
// when
ConsistencyReport.NodeConsistencyReport report = check(node);
// then
verify(report).labelDuplicate(11);
}
Aggregations