use of org.neo4j.kernel.impl.store.record.RelationshipRecord in project neo4j by neo4j.
the class FullCheckIntegrationTest method shouldHandleNegativeRelationshipNodePointers.
@Test
void shouldHandleNegativeRelationshipNodePointers() throws Exception {
// given
fixture.apply(new GraphStoreFixture.Transaction() {
@Override
protected void transactionData(GraphStoreFixture.TransactionDataBuilder tx, GraphStoreFixture.IdGenerator next) {
RelationshipRecord relationship = new RelationshipRecord(next.relationship());
relationship.setLinks(-2, -3, C);
tx.create(relationship);
tx.incrementRelationshipCount(ANY_LABEL, ANY_RELATIONSHIP_TYPE, ANY_LABEL, 1);
tx.incrementRelationshipCount(ANY_LABEL, C, ANY_LABEL, 1);
}
});
// when
ConsistencySummaryStatistics stats = check();
// then
on(stats).verify(RecordType.RELATIONSHIP, 2).andThatsAllFolks();
}
use of org.neo4j.kernel.impl.store.record.RelationshipRecord in project neo4j by neo4j.
the class FullCheckIntegrationTest method shouldReportCircularRelationshipPropertyRecordChain.
@Test
void shouldReportCircularRelationshipPropertyRecordChain() throws Exception {
int relType = createRelType();
shouldReportCircularPropertyRecordChain(RecordType.RELATIONSHIP, (tx, next, propertyRecordId) -> {
long node = next.node();
long relationship = next.relationship();
tx.create(new NodeRecord(node).initialize(true, -1, false, relationship, Record.NO_LABELS_FIELD.longValue()));
RelationshipRecord relationshipRecord = new RelationshipRecord(relationship);
relationshipRecord.setFirstNode(node);
relationshipRecord.setSecondNode(node);
relationshipRecord.setType(relType);
relationshipRecord.setNextProp(propertyRecordId);
tx.create(relationshipRecord);
});
}
use of org.neo4j.kernel.impl.store.record.RelationshipRecord in project neo4j by neo4j.
the class FullCheckIntegrationTest method shouldManageUnusedRecordsWithWeirdDataIn.
@Test
void shouldManageUnusedRecordsWithWeirdDataIn() throws Exception {
// Given
final AtomicLong id = new AtomicLong();
fixture.apply(new GraphStoreFixture.Transaction() {
@Override
protected void transactionData(TransactionDataBuilder tx, IdGenerator next) {
id.set(next.relationship());
RelationshipRecord relationship = new RelationshipRecord(id.get());
relationship.setFirstNode(-1);
relationship.setSecondNode(-1);
relationship.setInUse(true);
tx.create(relationship);
}
});
fixture.apply(new GraphStoreFixture.Transaction() {
@Override
protected void transactionData(TransactionDataBuilder tx, IdGenerator next) {
RelationshipRecord relationship = new RelationshipRecord(id.get());
tx.delete(relationship);
}
});
// When
ConsistencySummaryStatistics stats = check();
// Then
assertTrue(stats.isConsistent());
}
use of org.neo4j.kernel.impl.store.record.RelationshipRecord in project neo4j by neo4j.
the class FullCheckIntegrationTest method shouldReportRelationshipOtherNodeInconsistencies.
@Test
void shouldReportRelationshipOtherNodeInconsistencies() throws Exception {
// given
fixture.apply(new GraphStoreFixture.Transaction() {
@Override
protected void transactionData(GraphStoreFixture.TransactionDataBuilder tx, GraphStoreFixture.IdGenerator next) {
long node1 = next.node();
long node2 = next.node();
long rel = next.relationship();
RelationshipRecord relationship = new RelationshipRecord(rel);
relationship.setLinks(node1, node2, 0);
tx.create(inUse(relationship));
tx.create(inUse(new NodeRecord(node1).initialize(false, -1, false, rel + 1, 0)));
tx.create(inUse(new NodeRecord(node2).initialize(false, -1, false, rel + 2, 0)));
}
});
// when
ConsistencySummaryStatistics stats = check();
// then
on(stats).verify(RecordType.RELATIONSHIP, 2).verify(RecordType.NODE, 2).verify(RecordType.COUNTS, 2).andThatsAllFolks();
}
use of org.neo4j.kernel.impl.store.record.RelationshipRecord in project neo4j by neo4j.
the class CalculateDenseNodesStepTest method shouldNotProcessLoopsTwice.
@Test
void shouldNotProcessLoopsTwice() throws Exception {
// GIVEN
NodeRelationshipCache cache = mock(NodeRelationshipCache.class);
try (CalculateDenseNodesStep step = new CalculateDenseNodesStep(mock(StageControl.class), Configuration.DEFAULT, cache)) {
step.processors(4);
step.start(0);
// WHEN
long id = 0;
RelationshipRecord[] batch = batch(relationship(id++, 1, 5), relationship(id++, 3, 10), // <-- the loop
relationship(id++, 2, 2), relationship(id, 4, 1));
step.receive(0, batch);
step.endOfUpstream();
step.awaitCompleted();
// THEN
verify(cache, times(2)).incrementCount(eq(1L));
verify(cache).incrementCount(eq(2L));
verify(cache).incrementCount(eq(3L));
verify(cache).incrementCount(eq(4L));
verify(cache).incrementCount(eq(5L));
verify(cache).incrementCount(eq(10L));
}
}
Aggregations