use of org.neo4j.kernel.impl.store.record.NodeRecord in project neo4j by neo4j.
the class NodeRecordCheckTest method shouldNotReportAnythingForNodeWithConsistentReferences.
@Test
public void shouldNotReportAnythingForNodeWithConsistentReferences() throws Exception {
// given
NodeRecord node = inUse(new NodeRecord(42, false, 7, 11));
add(inUse(new RelationshipRecord(7, 42, 0, 0)));
add(inUse(new PropertyRecord(11)));
// when
ConsistencyReport.NodeConsistencyReport report = check(node);
// then
verifyNoMoreInteractions(report);
}
use of org.neo4j.kernel.impl.store.record.NodeRecord in project neo4j by neo4j.
the class NodeRecordCheckTest method shouldReportOutOfOrderLabels.
@Test
public void shouldReportOutOfOrderLabels() throws Exception {
// given
final NodeRecord node = inUse(new NodeRecord(42, false, NONE, NONE));
// We need to do this override so we can put the labels unsorted, since InlineNodeLabels always sorts on insert
new InlineNodeLabels(node) {
@Override
public Collection<DynamicRecord> put(long[] labelIds, NodeStore nodeStore, DynamicRecordAllocator allocator) {
return putSorted(node, labelIds, nodeStore, allocator);
}
}.put(new long[] { 3, 1, 2 }, null, null);
LabelTokenRecord label1 = inUse(new LabelTokenRecord(1));
LabelTokenRecord label2 = inUse(new LabelTokenRecord(2));
LabelTokenRecord label3 = inUse(new LabelTokenRecord(3));
add(label1);
add(label2);
add(label3);
add(node);
// when
ConsistencyReport.NodeConsistencyReport report = check(node);
// then
verify(report).labelsOutOfOrder(3, 1);
}
use of org.neo4j.kernel.impl.store.record.NodeRecord in project neo4j by neo4j.
the class NodeRecordCheckTest method shouldDynamicLabelRecordsNotInUse.
@Test
public void shouldDynamicLabelRecordsNotInUse() throws Exception {
// given
long[] labelIds = createLabels(100);
NodeRecord node = inUse(new NodeRecord(42, false, NONE, NONE));
add(node);
DynamicRecord labelsRecord1 = notInUse(array(new DynamicRecord(1)));
DynamicRecord labelsRecord2 = notInUse(array(new DynamicRecord(2)));
Collection<DynamicRecord> labelRecords = asList(labelsRecord1, labelsRecord2);
DynamicArrayStore.allocateFromNumbers(new ArrayList<>(), labelIds, new NotUsedReusableRecordsAllocator(52, labelRecords));
assertDynamicRecordChain(labelsRecord1, labelsRecord2);
node.setLabelField(DynamicNodeLabels.dynamicPointer(labelRecords), labelRecords);
addNodeDynamicLabels(labelsRecord1);
addNodeDynamicLabels(labelsRecord2);
// when
ConsistencyReport.NodeConsistencyReport report = check(node);
// then
verify(report).dynamicLabelRecordNotInUse(labelsRecord1);
verify(report).dynamicLabelRecordNotInUse(labelsRecord2);
}
use of org.neo4j.kernel.impl.store.record.NodeRecord in project neo4j by neo4j.
the class NodeRecordCheckTest method shouldReportLoopRelationshipNotFirstInTargetAndSourceChains.
@Test
public void shouldReportLoopRelationshipNotFirstInTargetAndSourceChains() throws Exception {
// given
NodeRecord node = inUse(new NodeRecord(42, false, 7, NONE));
RelationshipRecord relationship = add(inUse(new RelationshipRecord(7, 42, 42, 0)));
relationship.setFirstPrevRel(8);
relationship.setFirstInFirstChain(false);
relationship.setSecondPrevRel(8);
relationship.setFirstInSecondChain(false);
// when
ConsistencyReport.NodeConsistencyReport report = check(node);
// then
verify(report).relationshipNotFirstInSourceChain(relationship);
verify(report).relationshipNotFirstInTargetChain(relationship);
verifyNoMoreInteractions(report);
}
use of org.neo4j.kernel.impl.store.record.NodeRecord in project neo4j by neo4j.
the class NodeRecordCheckTest method shouldReportDuplicateLabels.
@Test
public void shouldReportDuplicateLabels() throws Exception {
// given
NodeRecord node = inUse(new NodeRecord(42, false, NONE, NONE));
new InlineNodeLabels(node).put(new long[] { 1, 2, 1 }, null, null);
LabelTokenRecord label1 = inUse(new LabelTokenRecord(1));
LabelTokenRecord label2 = inUse(new LabelTokenRecord(2));
add(label1);
add(label2);
add(node);
// when
ConsistencyReport.NodeConsistencyReport report = check(node);
// then
verify(report).labelDuplicate(1);
}
Aggregations