use of org.neo4j.consistency.report.ConsistencySummaryStatistics in project neo4j by neo4j.
the class FullCheckIntegrationTest method shouldReportCyclesInDynamicRecordsWithLabels.
@Test
public void shouldReportCyclesInDynamicRecordsWithLabels() throws Exception {
// given
final List<DynamicRecord> chain = chainOfDynamicRecordsWithLabelsForANode(176).first();
assertEquals("number of records in chain", 3, chain.size());
assertEquals("all records full", chain.get(0).getLength(), chain.get(2).getLength());
fixture.apply(new GraphStoreFixture.Transaction() {
@Override
protected void transactionData(GraphStoreFixture.TransactionDataBuilder tx, GraphStoreFixture.IdGenerator next) {
long nodeId = ((long[]) getRightArray(readFullByteArrayFromHeavyRecords(chain, ARRAY)))[0];
NodeRecord before = inUse(new NodeRecord(nodeId, false, -1, -1));
NodeRecord after = inUse(new NodeRecord(nodeId, false, -1, -1));
DynamicRecord record1 = chain.get(0).clone();
DynamicRecord record2 = chain.get(1).clone();
DynamicRecord record3 = chain.get(2).clone();
record3.setNextBlock(record2.getId());
before.setLabelField(dynamicPointer(chain), chain);
after.setLabelField(dynamicPointer(chain), asList(record1, record2, record3));
tx.update(before, after);
}
});
// when
ConsistencySummaryStatistics stats = check();
// then
on(stats).verify(RecordType.NODE, 1).verify(RecordType.COUNTS, 177).andThatsAllFolks();
}
use of org.neo4j.consistency.report.ConsistencySummaryStatistics 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();
}
use of org.neo4j.consistency.report.ConsistencySummaryStatistics in project neo4j by neo4j.
the class FullCheckIntegrationTest method shouldReportInvalidConstraintBackReferences.
@Test
public void shouldReportInvalidConstraintBackReferences() throws Exception {
// given
fixture.apply(new GraphStoreFixture.Transaction() {
@Override
protected void transactionData(GraphStoreFixture.TransactionDataBuilder tx, GraphStoreFixture.IdGenerator next) {
int ruleId1 = (int) next.schema();
int ruleId2 = (int) next.schema();
int labelId = next.label();
int propertyKeyId = next.propertyKey();
DynamicRecord record1 = new DynamicRecord(ruleId1);
DynamicRecord record2 = new DynamicRecord(ruleId2);
DynamicRecord record1Before = record1.clone();
DynamicRecord record2Before = record2.clone();
IndexRule rule1 = constraintIndexRule(ruleId1, labelId, propertyKeyId, DESCRIPTOR, (long) ruleId2);
ConstraintRule rule2 = uniquenessConstraintRule(ruleId2, labelId, propertyKeyId, ruleId2);
Collection<DynamicRecord> records1 = serializeRule(rule1, record1);
Collection<DynamicRecord> records2 = serializeRule(rule2, record2);
assertEquals(asList(record1), records1);
assertEquals(asList(record2), records2);
tx.nodeLabel(labelId, "label");
tx.propertyKey(propertyKeyId, "property");
tx.createSchema(asList(record1Before), records1, rule1);
tx.createSchema(asList(record2Before), records2, rule2);
}
});
// when
ConsistencySummaryStatistics stats = check();
// then
on(stats).verify(RecordType.SCHEMA, 2).andThatsAllFolks();
}
use of org.neo4j.consistency.report.ConsistencySummaryStatistics in project neo4j by neo4j.
the class FullCheckIntegrationTest method shouldReportRelationshipTypeInconsistencies.
@Test
public void shouldReportRelationshipTypeInconsistencies() throws Exception {
// given
StoreAccess access = fixture.directStoreAccess().nativeStores();
RecordStore<RelationshipTypeTokenRecord> relTypeStore = access.getRelationshipTypeTokenStore();
RelationshipTypeTokenRecord record = relTypeStore.getRecord((int) relTypeStore.nextId(), relTypeStore.newRecord(), FORCE);
record.setNameId(20);
record.setInUse(true);
relTypeStore.updateRecord(record);
// when
ConsistencySummaryStatistics stats = check();
// then
access.close();
on(stats).verify(RecordType.RELATIONSHIP_TYPE, 1).andThatsAllFolks();
}
use of org.neo4j.consistency.report.ConsistencySummaryStatistics in project neo4j by neo4j.
the class FullCheckIntegrationTest method shouldReportDuplicatedIndexRules.
@Test
public void shouldReportDuplicatedIndexRules() throws Exception {
// Given
int labelId = createLabel();
int propertyKeyId = createPropertyKey();
createIndexRule(labelId, propertyKeyId);
createIndexRule(labelId, propertyKeyId);
// When
ConsistencySummaryStatistics stats = check();
// Then
on(stats).verify(RecordType.SCHEMA, 1).andThatsAllFolks();
}
Aggregations