use of org.neo4j.consistency.report.ConsistencySummaryStatistics 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.consistency.report.ConsistencySummaryStatistics in project neo4j by neo4j.
the class FullCheckIntegrationTest method shouldNotReportIndexInconsistenciesIfIndexIsFailed.
@Test
public void shouldNotReportIndexInconsistenciesIfIndexIsFailed() throws Exception {
// this test fails all indexes, and then destroys a record and makes sure we only get a failure for
// the label scan store but not for any index
// given
DirectStoreAccess storeAccess = fixture.directStoreAccess();
// fail all indexes
Iterator<IndexRule> rules = new SchemaStorage(storeAccess.nativeStores().getSchemaStore()).indexesGetAll();
while (rules.hasNext()) {
IndexRule rule = rules.next();
IndexSamplingConfig samplingConfig = new IndexSamplingConfig(Config.empty());
IndexPopulator populator = storeAccess.indexes().getPopulator(rule.getId(), rule.getIndexDescriptor(), samplingConfig);
populator.markAsFailed("Oh noes! I was a shiny index and then I was failed");
populator.close(false);
}
for (Long indexedNodeId : indexedNodes) {
storeAccess.nativeStores().getNodeStore().updateRecord(notInUse(new NodeRecord(indexedNodeId, false, -1, -1)));
}
// when
ConsistencySummaryStatistics stats = check();
// then
on(stats).verify(RecordType.LABEL_SCAN_DOCUMENT, 1).verify(RecordType.COUNTS, 3).andThatsAllFolks();
}
use of org.neo4j.consistency.report.ConsistencySummaryStatistics 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.consistency.report.ConsistencySummaryStatistics in project neo4j by neo4j.
the class FullCheckIntegrationTest method shouldReportDuplicatedNodePropertyExistenceConstraintRules.
@Test
public void shouldReportDuplicatedNodePropertyExistenceConstraintRules() throws Exception {
// Given
int labelId = createLabel();
int propertyKeyId = createPropertyKey();
createNodePropertyExistenceConstraint(labelId, propertyKeyId);
createNodePropertyExistenceConstraint(labelId, propertyKeyId);
// When
ConsistencySummaryStatistics stats = check();
// Then
on(stats).verify(RecordType.SCHEMA, 1).andThatsAllFolks();
}
use of org.neo4j.consistency.report.ConsistencySummaryStatistics in project neo4j by neo4j.
the class FullCheckIntegrationTest method shouldReportNodesWithDuplicatePropertyValueInUniqueIndex.
@Test
public void shouldReportNodesWithDuplicatePropertyValueInUniqueIndex() throws Exception {
// given
IndexSamplingConfig samplingConfig = new IndexSamplingConfig(Config.empty());
Iterator<IndexRule> indexRuleIterator = new SchemaStorage(fixture.directStoreAccess().nativeStores().getSchemaStore()).indexesGetAll();
while (indexRuleIterator.hasNext()) {
IndexRule indexRule = indexRuleIterator.next();
IndexAccessor accessor = fixture.directStoreAccess().indexes().getOnlineAccessor(indexRule.getId(), indexRule.getIndexDescriptor(), samplingConfig);
IndexUpdater updater = accessor.newUpdater(IndexUpdateMode.ONLINE);
updater.process(IndexEntryUpdate.add(42, indexRule.getIndexDescriptor().schema(), "value"));
updater.close();
accessor.close();
}
// when
ConsistencySummaryStatistics stats = check();
// then
on(stats).verify(RecordType.NODE, 1).verify(RecordType.INDEX, 2).andThatsAllFolks();
}
Aggregations