Search in sources :

Example 11 with NodeRecord

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

the class NodeInUseWithCorrectLabelsCheckTest method shouldRemainSilentWhenEverythingIsInOrder.

@Test
public void shouldRemainSilentWhenEverythingIsInOrder() throws Exception {
    // given
    int nodeId = 42;
    int labelId = 7;
    NodeRecord node = withInlineLabels(inUse(new NodeRecord(nodeId, false, 0, 0)), labelId);
    ConsistencyReport.LabelScanConsistencyReport report = mock(ConsistencyReport.LabelScanConsistencyReport.class);
    // when
    checker(new long[] { labelId }, true).checkReference(null, node, engineFor(report), null);
    // then
    verifyNoMoreInteractions(report);
}
Also used : NodeRecord(org.neo4j.kernel.impl.store.record.NodeRecord) ConsistencyReport(org.neo4j.consistency.report.ConsistencyReport) Test(org.junit.Test)

Example 12 with NodeRecord

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

the class NodeInUseWithCorrectLabelsCheckTest method shouldReportNodeWithoutExpectedLabelWhenLabelsAreInlineBothDirections.

@Test
public void shouldReportNodeWithoutExpectedLabelWhenLabelsAreInlineBothDirections() throws Exception {
    // given
    int nodeId = 42;
    long[] storeLabelIds = new long[] { 7, 9 };
    long[] indexLabelIds = new long[] { 9, 10 };
    NodeRecord node = inUse(withInlineLabels(new NodeRecord(nodeId, false, 0, 0), storeLabelIds));
    ConsistencyReport.LabelScanConsistencyReport report = mock(ConsistencyReport.LabelScanConsistencyReport.class);
    // when
    checker(indexLabelIds, true).checkReference(null, node, engineFor(report), null);
    // then
    verify(report).nodeDoesNotHaveExpectedLabel(node, 10);
}
Also used : NodeRecord(org.neo4j.kernel.impl.store.record.NodeRecord) ConsistencyReport(org.neo4j.consistency.report.ConsistencyReport) Test(org.junit.Test)

Example 13 with NodeRecord

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

the class OwnerCheckTest method shouldNotReportAnythingForNodesWithDifferentPropertyChains.

@Test
public void shouldNotReportAnythingForNodesWithDifferentPropertyChains() throws Exception {
    // given
    OwnerCheck decorator = new OwnerCheck(true);
    RecordCheck<NodeRecord, ConsistencyReport.NodeConsistencyReport> nodeChecker = decorator.decorateNodeChecker(dummyNodeCheck());
    RecordAccessStub records = new RecordAccessStub();
    NodeRecord node1 = records.add(inUse(new NodeRecord(1, false, NONE, 7)));
    NodeRecord node2 = records.add(inUse(new NodeRecord(2, false, NONE, 8)));
    // when
    ConsistencyReport.NodeConsistencyReport report1 = check(ConsistencyReport.NodeConsistencyReport.class, nodeChecker, node1, records);
    ConsistencyReport.NodeConsistencyReport report2 = check(ConsistencyReport.NodeConsistencyReport.class, nodeChecker, node2, records);
    // then
    verifyZeroInteractions(report1);
    verifyZeroInteractions(report2);
}
Also used : NodeRecord(org.neo4j.kernel.impl.store.record.NodeRecord) RecordAccessStub(org.neo4j.consistency.store.RecordAccessStub) ConsistencyReport(org.neo4j.consistency.report.ConsistencyReport) Test(org.junit.Test)

Example 14 with NodeRecord

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

the class FullCheckIntegrationTest method shouldReportRelationshipGroupChainInconsistencies.

@Test
public void shouldReportRelationshipGroupChainInconsistencies() throws Exception {
    // given
    fixture.apply(new GraphStoreFixture.Transaction() {

        @Override
        protected void transactionData(GraphStoreFixture.TransactionDataBuilder tx, GraphStoreFixture.IdGenerator next) {
            long node = next.node();
            long group = next.relationshipGroup();
            tx.create(inUse(new NodeRecord(node, true, group, NO_NEXT_PROPERTY.intValue())));
            tx.create(withOwner(withNext(inUse(new RelationshipGroupRecord(group, C)), group + 1), node));
        }
    });
    // when
    ConsistencySummaryStatistics stats = check();
    // then
    on(stats).verify(RecordType.RELATIONSHIP_GROUP, 1).andThatsAllFolks();
}
Also used : NodeRecord(org.neo4j.kernel.impl.store.record.NodeRecord) RelationshipGroupRecord(org.neo4j.kernel.impl.store.record.RelationshipGroupRecord) TransactionDataBuilder(org.neo4j.consistency.checking.GraphStoreFixture.TransactionDataBuilder) IdGenerator(org.neo4j.consistency.checking.GraphStoreFixture.IdGenerator) GraphStoreFixture(org.neo4j.consistency.checking.GraphStoreFixture) ConsistencySummaryStatistics(org.neo4j.consistency.report.ConsistencySummaryStatistics) Test(org.junit.Test)

Example 15 with NodeRecord

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

the class FullCheckIntegrationTest method shouldReportFirstRelationshipGroupOwnerInconsistency.

@Test
public void shouldReportFirstRelationshipGroupOwnerInconsistency() throws Exception {
    // given
    fixture.apply(new GraphStoreFixture.Transaction() {

        @Override
        protected void transactionData(GraphStoreFixture.TransactionDataBuilder tx, GraphStoreFixture.IdGenerator next) {
            // node -[first]-> group -[owner]-> otherNode
            long node = next.node();
            long otherNode = next.node();
            long group = next.relationshipGroup();
            tx.create(inUse(new NodeRecord(node, true, group, NO_NEXT_PROPERTY.intValue())));
            tx.create(inUse(new NodeRecord(otherNode, false, NO_NEXT_RELATIONSHIP.intValue(), NO_NEXT_PROPERTY.intValue())));
            tx.create(withOwner(inUse(new RelationshipGroupRecord(group, C)), otherNode));
        }
    });
    // when
    ConsistencySummaryStatistics stats = check();
    // then
    // - next group has other owner that its previous
    // - first group has other owner
    on(stats).verify(RecordType.NODE, 1).andThatsAllFolks();
}
Also used : NodeRecord(org.neo4j.kernel.impl.store.record.NodeRecord) RelationshipGroupRecord(org.neo4j.kernel.impl.store.record.RelationshipGroupRecord) TransactionDataBuilder(org.neo4j.consistency.checking.GraphStoreFixture.TransactionDataBuilder) IdGenerator(org.neo4j.consistency.checking.GraphStoreFixture.IdGenerator) GraphStoreFixture(org.neo4j.consistency.checking.GraphStoreFixture) ConsistencySummaryStatistics(org.neo4j.consistency.report.ConsistencySummaryStatistics) 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