Search in sources :

Example 56 with RelationshipGroupRecord

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

the class TransactionWriter method delete.

public void delete(RelationshipGroupRecord group) {
    group.setInUse(false);
    add(group, new RelationshipGroupRecord(group.getId(), group.getType()));
}
Also used : RelationshipGroupRecord(org.neo4j.kernel.impl.store.record.RelationshipGroupRecord)

Example 57 with RelationshipGroupRecord

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

the class FullCheckIntegrationTest method shouldReportRelationshipGroupRelationshipOfOtherTypeInconsistencies.

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

        @Override
        protected void transactionData(GraphStoreFixture.TransactionDataBuilder tx, GraphStoreFixture.IdGenerator next) {
            /*
                 *   node -----> groupA
                 *                   |
                 *                   v
                 *   otherNode <--> relB
                 */
            long node = next.node();
            long otherNode = next.node();
            long group = next.relationshipGroup();
            long rel = next.relationship();
            tx.create(new NodeRecord(node, true, group, NO_NEXT_PROPERTY.intValue()));
            tx.create(new NodeRecord(otherNode, false, rel, NO_NEXT_PROPERTY.intValue()));
            tx.create(new RelationshipRecord(rel, otherNode, otherNode, T));
            tx.create(withOwner(withRelationships(new RelationshipGroupRecord(group, C), rel, rel, rel), node));
            tx.incrementRelationshipCount(ANY_LABEL, ANY_RELATIONSHIP_TYPE, ANY_LABEL, 1);
            tx.incrementRelationshipCount(ANY_LABEL, T, ANY_LABEL, 1);
        }
    });
    // 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 58 with RelationshipGroupRecord

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

the class FullCheckIntegrationTest method shouldReportRelationshipGroupTypeInconsistencies.

@Test
public void shouldReportRelationshipGroupTypeInconsistencies() 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();
            int nonExistentType = next.relationshipType() + 1;
            tx.create(inUse(new NodeRecord(node, true, group, NO_NEXT_PROPERTY.intValue())));
            tx.create(withOwner(inUse(new RelationshipGroupRecord(group, nonExistentType)), 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 59 with RelationshipGroupRecord

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

the class FullCheckIntegrationTest method shouldReportRelationshipGroupRelationshipNotInUseInconsistencies.

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

        @Override
        protected void transactionData(GraphStoreFixture.TransactionDataBuilder tx, GraphStoreFixture.IdGenerator next) {
            long node = next.node();
            long groupId = next.relationshipGroup();
            long rel = next.relationship();
            tx.create(inUse(new NodeRecord(node, true, groupId, NO_NEXT_PROPERTY.intValue())));
            tx.create(withOwner(withRelationships(inUse(new RelationshipGroupRecord(groupId, C)), rel, rel, rel), node));
        }
    });
    // 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) GraphStoreFixture(org.neo4j.consistency.checking.GraphStoreFixture) ConsistencySummaryStatistics(org.neo4j.consistency.report.ConsistencySummaryStatistics) Test(org.junit.Test)

Example 60 with RelationshipGroupRecord

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

the class FullCheckIntegrationTest method shouldNotReportRelationshipGroupInconsistenciesForConsistentRecords.

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

        @Override
        protected void transactionData(GraphStoreFixture.TransactionDataBuilder tx, GraphStoreFixture.IdGenerator next) {
            /* Create a little mini consistent structure:
                 *
                 *    nodeA --> groupA -[next]-> groupB
                 *      ^          |
                 *       \       [out]
                 *        \        v
                 *       [start]- rel -[end]-> nodeB
                 */
            long nodeA = next.node();
            long nodeB = next.node();
            long rel = next.relationship();
            long groupA = next.relationshipGroup();
            long groupB = next.relationshipGroup();
            tx.create(new NodeRecord(nodeA, true, groupA, NO_NEXT_PROPERTY.intValue()));
            tx.create(new NodeRecord(nodeB, false, rel, NO_NEXT_PROPERTY.intValue()));
            tx.create(firstInChains(new RelationshipRecord(rel, nodeA, nodeB, C), 1));
            tx.incrementRelationshipCount(ANY_LABEL, ANY_RELATIONSHIP_TYPE, ANY_LABEL, 1);
            tx.incrementRelationshipCount(ANY_LABEL, C, ANY_LABEL, 1);
            tx.create(withOwner(withRelationship(withNext(new RelationshipGroupRecord(groupA, C), groupB), Direction.OUTGOING, rel), nodeA));
            tx.create(withOwner(new RelationshipGroupRecord(groupB, T), nodeA));
        }
    });
    // when
    ConsistencySummaryStatistics stats = check();
    // then
    assertTrue("should be consistent", stats.isConsistent());
}
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)

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