Search in sources :

Example 61 with RelationshipGroupRecord

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

the class FullCheckIntegrationTest method shouldReportRelationshipGroupOwnerNotInUse.

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

        @Override
        protected void transactionData(GraphStoreFixture.TransactionDataBuilder tx, GraphStoreFixture.IdGenerator next) {
            // group -[owner]-> <not-in-use node>
            long node = next.node();
            long group = next.relationshipGroup();
            tx.create(withOwner(inUse(new RelationshipGroupRecord(group, C)), node));
        }
    });
    // when
    ConsistencySummaryStatistics stats = check();
    // then
    on(stats).verify(RecordType.RELATIONSHIP_GROUP, 1).andThatsAllFolks();
}
Also used : 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 62 with RelationshipGroupRecord

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

the class FullCheckIntegrationTest method shouldReportRelationshipGroupRelationshipNotFirstInconsistencies.

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

        @Override
        protected void transactionData(GraphStoreFixture.TransactionDataBuilder tx, GraphStoreFixture.IdGenerator next) {
            /*
                 *   node ----------------> group
                 *                             |
                 *                             v
                 *   otherNode <--> relA <--> relB
                 */
            long node = next.node();
            long otherNode = next.node();
            long group = next.relationshipGroup();
            long relA = next.relationship();
            long relB = next.relationship();
            tx.create(inUse(new NodeRecord(node, true, group, NO_NEXT_PROPERTY.intValue())));
            tx.create(inUse(new NodeRecord(otherNode, false, relA, NO_NEXT_PROPERTY.intValue())));
            tx.create(withNext(inUse(new RelationshipRecord(relA, otherNode, otherNode, C)), relB));
            tx.create(withPrev(inUse(new RelationshipRecord(relB, otherNode, otherNode, C)), relA));
            tx.create(withOwner(withRelationships(inUse(new RelationshipGroupRecord(group, C)), relB, relB, relB), node));
            tx.incrementRelationshipCount(ANY_LABEL, ANY_RELATIONSHIP_TYPE, ANY_LABEL, 2);
            tx.incrementRelationshipCount(ANY_LABEL, C, ANY_LABEL, 2);
        }
    });
    // when
    ConsistencySummaryStatistics stats = check();
    // then
    on(stats).verify(RecordType.RELATIONSHIP_GROUP, 3).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) RelationshipRecord(org.neo4j.kernel.impl.store.record.RelationshipRecord) GraphStoreFixture(org.neo4j.consistency.checking.GraphStoreFixture) ConsistencySummaryStatistics(org.neo4j.consistency.report.ConsistencySummaryStatistics) Test(org.junit.Test)

Example 63 with RelationshipGroupRecord

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

the class FullCheckIntegrationTest method shouldReportRelationshipGroupUnsortedChainInconsistencies.

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

        @Override
        protected void transactionData(GraphStoreFixture.TransactionDataBuilder tx, GraphStoreFixture.IdGenerator next) {
            long node = next.node();
            long firstGroupId = next.relationshipGroup();
            long otherGroupId = next.relationshipGroup();
            tx.create(inUse(new NodeRecord(node, true, firstGroupId, NO_NEXT_PROPERTY.intValue())));
            tx.create(withOwner(withNext(inUse(new RelationshipGroupRecord(firstGroupId, T)), otherGroupId), node));
            tx.create(withOwner(inUse(new RelationshipGroupRecord(otherGroupId, C)), 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 64 with RelationshipGroupRecord

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

the class RelationshipGroupRecordFormatTest method useVariableLengthFormatWhenOneOfTheReferencesReferenceTooBig.

@Test
public void useVariableLengthFormatWhenOneOfTheReferencesReferenceTooBig() throws IOException {
    RelationshipGroupRecord source = new RelationshipGroupRecord(1);
    RelationshipGroupRecord target = new RelationshipGroupRecord(1);
    verifyRecordsWithPoisonedReference(source, target, 1L << (Integer.SIZE + 2));
}
Also used : RelationshipGroupRecord(org.neo4j.kernel.impl.store.record.RelationshipGroupRecord) Test(org.junit.Test)

Example 65 with RelationshipGroupRecord

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

the class HighIdTransactionApplierTest method shouldTrackSecondaryUnitIdsAsWell.

@Test
public void shouldTrackSecondaryUnitIdsAsWell() throws Exception {
    // GIVEN
    NeoStores neoStores = neoStoresRule.open();
    HighIdTransactionApplier tracker = new HighIdTransactionApplier(neoStores);
    NodeRecord node = new NodeRecord(5).initialize(true, 123, true, 456, 0);
    node.setSecondaryUnitId(6);
    node.setRequiresSecondaryUnit(true);
    RelationshipRecord relationship = new RelationshipRecord(10).initialize(true, 1, 2, 3, 4, 5, 6, 7, 8, true, true);
    relationship.setSecondaryUnitId(12);
    relationship.setRequiresSecondaryUnit(true);
    RelationshipGroupRecord relationshipGroup = new RelationshipGroupRecord(8).initialize(true, 0, 1, 2, 3, 4, 5);
    relationshipGroup.setSecondaryUnitId(20);
    relationshipGroup.setRequiresSecondaryUnit(true);
    // WHEN
    tracker.visitNodeCommand(new NodeCommand(new NodeRecord(node.getId()), node));
    tracker.visitRelationshipCommand(new RelationshipCommand(new RelationshipRecord(relationship.getId()), relationship));
    tracker.visitRelationshipGroupCommand(new RelationshipGroupCommand(new RelationshipGroupRecord(relationshipGroup.getId()), relationshipGroup));
    tracker.close();
    // THEN
    assertEquals(node.getSecondaryUnitId() + 1, neoStores.getNodeStore().getHighId());
    assertEquals(relationship.getSecondaryUnitId() + 1, neoStores.getRelationshipStore().getHighId());
    assertEquals(relationshipGroup.getSecondaryUnitId() + 1, neoStores.getRelationshipGroupStore().getHighId());
}
Also used : NodeRecord(org.neo4j.kernel.impl.store.record.NodeRecord) RelationshipGroupRecord(org.neo4j.kernel.impl.store.record.RelationshipGroupRecord) NeoStores(org.neo4j.kernel.impl.store.NeoStores) RelationshipRecord(org.neo4j.kernel.impl.store.record.RelationshipRecord) RelationshipGroupCommand(org.neo4j.kernel.impl.transaction.command.Command.RelationshipGroupCommand) RelationshipCommand(org.neo4j.kernel.impl.transaction.command.Command.RelationshipCommand) NodeCommand(org.neo4j.kernel.impl.transaction.command.Command.NodeCommand) Test(org.junit.Test)

Aggregations

RelationshipGroupRecord (org.neo4j.kernel.impl.store.record.RelationshipGroupRecord)83 Test (org.junit.Test)42 NodeRecord (org.neo4j.kernel.impl.store.record.NodeRecord)24 GraphStoreFixture (org.neo4j.consistency.checking.GraphStoreFixture)11 IdGenerator (org.neo4j.consistency.checking.GraphStoreFixture.IdGenerator)11 TransactionDataBuilder (org.neo4j.consistency.checking.GraphStoreFixture.TransactionDataBuilder)11 ConsistencySummaryStatistics (org.neo4j.consistency.report.ConsistencySummaryStatistics)11 RelationshipRecord (org.neo4j.kernel.impl.store.record.RelationshipRecord)10 Command (org.neo4j.kernel.impl.transaction.command.Command)5 IOException (java.io.IOException)4 InMemoryClosableChannel (org.neo4j.kernel.impl.transaction.log.InMemoryClosableChannel)4 File (java.io.File)3 Node (org.neo4j.graphdb.Node)3 Relationship (org.neo4j.graphdb.Relationship)3 Transaction (org.neo4j.graphdb.Transaction)3 RecordStorageEngine (org.neo4j.kernel.impl.storageengine.impl.recordstorage.RecordStorageEngine)3 NeoStores (org.neo4j.kernel.impl.store.NeoStores)3 RelationshipStore (org.neo4j.kernel.impl.store.RelationshipStore)3 PropertyRecord (org.neo4j.kernel.impl.store.record.PropertyRecord)3 RelationshipGroupCommand (org.neo4j.kernel.impl.transaction.command.Command.RelationshipGroupCommand)3