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();
}
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();
}
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();
}
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));
}
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());
}
Aggregations