Search in sources :

Example 41 with NodeRecord

use of org.neo4j.kernel.impl.store.record.NodeRecord 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);
}
Also used : DynamicRecord(org.neo4j.kernel.impl.store.record.DynamicRecord) NodeRecord(org.neo4j.kernel.impl.store.record.NodeRecord) ReusableRecordsAllocator(org.neo4j.kernel.impl.store.allocator.ReusableRecordsAllocator) ConsistencyReport(org.neo4j.consistency.report.ConsistencyReport) Test(org.junit.Test)

Example 42 with NodeRecord

use of org.neo4j.kernel.impl.store.record.NodeRecord in project neo4j by neo4j.

the class RelationshipRecordCheckTest method shouldReportTargetNodeNotReferencingBackForFirstRelationshipInTargetChain.

@Test
public void shouldReportTargetNodeNotReferencingBackForFirstRelationshipInTargetChain() throws Exception {
    // given
    checkSingleDirection();
    initialize(RELATIONSHIPS, NODES);
    RelationshipRecord relationship = inUse(new RelationshipRecord(42, 1, 2, 4));
    add(inUse(new RelationshipTypeTokenRecord(4)));
    add(inUse(new NodeRecord(1, false, 42, NONE)));
    NodeRecord target = add(inUse(new NodeRecord(2, false, 7, NONE)));
    // when
    ConsistencyReport.RelationshipConsistencyReport report = check(relationship);
    // then
    verify(report).targetNodeDoesNotReferenceBack(target);
    verifyNoMoreInteractions(report);
}
Also used : NodeRecord(org.neo4j.kernel.impl.store.record.NodeRecord) RelationshipTypeTokenRecord(org.neo4j.kernel.impl.store.record.RelationshipTypeTokenRecord) RelationshipRecord(org.neo4j.kernel.impl.store.record.RelationshipRecord) ConsistencyReport(org.neo4j.consistency.report.ConsistencyReport) Test(org.junit.Test)

Example 43 with NodeRecord

use of org.neo4j.kernel.impl.store.record.NodeRecord in project neo4j by neo4j.

the class RelationshipRecordCheckTest method shouldReportSourceNodeNotInUse.

@Test
public void shouldReportSourceNodeNotInUse() throws Exception {
    // given
    checkSingleDirection();
    initialize(RELATIONSHIPS, NODES);
    RelationshipRecord relationship = inUse(new RelationshipRecord(42, 1, 2, 4));
    add(inUse(new RelationshipTypeTokenRecord(4)));
    NodeRecord node = add(notInUse(new NodeRecord(1, false, NONE, NONE)));
    add(inUse(new NodeRecord(2, false, 42, NONE)));
    // when
    ConsistencyReport.RelationshipConsistencyReport report = check(relationship);
    // then
    verify(report).sourceNodeNotInUse(node);
    verifyNoMoreInteractions(report);
}
Also used : NodeRecord(org.neo4j.kernel.impl.store.record.NodeRecord) RelationshipTypeTokenRecord(org.neo4j.kernel.impl.store.record.RelationshipTypeTokenRecord) RelationshipRecord(org.neo4j.kernel.impl.store.record.RelationshipRecord) ConsistencyReport(org.neo4j.consistency.report.ConsistencyReport) Test(org.junit.Test)

Example 44 with NodeRecord

use of org.neo4j.kernel.impl.store.record.NodeRecord in project neo4j by neo4j.

the class RelationshipRecordCheckTest method shouldReportSourceNextReferencingOtherNodes.

@Test
public void shouldReportSourceNextReferencingOtherNodes() throws Exception {
    // given
    RelationshipRecord relationship = inUse(new RelationshipRecord(42, 1, 2, 4));
    add(inUse(new RelationshipTypeTokenRecord(4)));
    add(inUse(new NodeRecord(1, false, 42, NONE)));
    add(inUse(new NodeRecord(2, false, 42, NONE)));
    RelationshipRecord sNext = add(inUse(new RelationshipRecord(51, 8, 9, 0)));
    relationship.setFirstNextRel(sNext.getId());
    // when
    ConsistencyReport.RelationshipConsistencyReport report = check(relationship);
    // then
    verify(report).sourceNextReferencesOtherNodes(sNext);
    verifyNoMoreInteractions(report);
}
Also used : NodeRecord(org.neo4j.kernel.impl.store.record.NodeRecord) RelationshipTypeTokenRecord(org.neo4j.kernel.impl.store.record.RelationshipTypeTokenRecord) RelationshipRecord(org.neo4j.kernel.impl.store.record.RelationshipRecord) ConsistencyReport(org.neo4j.consistency.report.ConsistencyReport) Test(org.junit.Test)

Example 45 with NodeRecord

use of org.neo4j.kernel.impl.store.record.NodeRecord in project neo4j by neo4j.

the class RelationshipRecordCheckTest method shouldNotReportAnythingForRelationshipThatDoesNotReferenceOtherRecords.

@Test
public void shouldNotReportAnythingForRelationshipThatDoesNotReferenceOtherRecords() throws Exception {
    // given
    RelationshipRecord relationship = inUse(new RelationshipRecord(42, 1, 2, 4));
    add(inUse(new RelationshipTypeTokenRecord(4)));
    add(inUse(new NodeRecord(1, false, 42, NONE)));
    add(inUse(new NodeRecord(2, false, 42, NONE)));
    // when
    ConsistencyReport.RelationshipConsistencyReport report = check(relationship);
    // then
    verifyNoMoreInteractions(report);
}
Also used : NodeRecord(org.neo4j.kernel.impl.store.record.NodeRecord) RelationshipTypeTokenRecord(org.neo4j.kernel.impl.store.record.RelationshipTypeTokenRecord) RelationshipRecord(org.neo4j.kernel.impl.store.record.RelationshipRecord) ConsistencyReport(org.neo4j.consistency.report.ConsistencyReport) Test(org.junit.Test)

Aggregations

NodeRecord (org.neo4j.kernel.impl.store.record.NodeRecord)257 Test (org.junit.Test)190 ConsistencyReport (org.neo4j.consistency.report.ConsistencyReport)62 RelationshipRecord (org.neo4j.kernel.impl.store.record.RelationshipRecord)51 DynamicRecord (org.neo4j.kernel.impl.store.record.DynamicRecord)38 Command (org.neo4j.kernel.impl.transaction.command.Command)29 RelationshipTypeTokenRecord (org.neo4j.kernel.impl.store.record.RelationshipTypeTokenRecord)28 RelationshipGroupRecord (org.neo4j.kernel.impl.store.record.RelationshipGroupRecord)27 PropertyRecord (org.neo4j.kernel.impl.store.record.PropertyRecord)26 ConsistencySummaryStatistics (org.neo4j.consistency.report.ConsistencySummaryStatistics)23 NodeLabels (org.neo4j.kernel.impl.store.NodeLabels)23 GraphStoreFixture (org.neo4j.consistency.checking.GraphStoreFixture)22 IdGenerator (org.neo4j.consistency.checking.GraphStoreFixture.IdGenerator)22 TransactionDataBuilder (org.neo4j.consistency.checking.GraphStoreFixture.TransactionDataBuilder)22 ArrayList (java.util.ArrayList)19 DynamicNodeLabels (org.neo4j.kernel.impl.store.DynamicNodeLabels)19 File (java.io.File)15 RecordAccessStub (org.neo4j.consistency.store.RecordAccessStub)13 NodeStore (org.neo4j.kernel.impl.store.NodeStore)11 ReusableRecordsAllocator (org.neo4j.kernel.impl.store.allocator.ReusableRecordsAllocator)10