use of org.neo4j.consistency.report.ConsistencySummaryStatistics in project neo4j by neo4j.
the class FullCheckIntegrationTest method shouldReportNodesThatAreNotIndexed.
@Test
public void shouldReportNodesThatAreNotIndexed() 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.remove(asPrimitiveLongSet(indexedNodes));
updater.close();
accessor.close();
}
// when
ConsistencySummaryStatistics stats = check();
// then
on(stats).verify(RecordType.NODE, 1).andThatsAllFolks();
}
use of org.neo4j.consistency.report.ConsistencySummaryStatistics in project neo4j by neo4j.
the class FullCheckIntegrationTest method shouldManageUnusedRecordsWithWeirdDataIn.
@Test
public 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.consistency.report.ConsistencySummaryStatistics in project neo4j by neo4j.
the class FullCheckIntegrationTest method shouldReportOrphanedNodeDynamicLabelAsNodeInconsistency.
@Test
public void shouldReportOrphanedNodeDynamicLabelAsNodeInconsistency() throws Exception {
// given
fixture.apply(new GraphStoreFixture.Transaction() {
@Override
protected void transactionData(GraphStoreFixture.TransactionDataBuilder tx, GraphStoreFixture.IdGenerator next) {
tx.nodeLabel(42, "Label");
NodeRecord nodeRecord = new NodeRecord(next.node(), false, -1, -1);
DynamicRecord record = inUse(new DynamicRecord(next.nodeLabel()));
Collection<DynamicRecord> newRecords = new ArrayList<>();
allocateFromNumbers(newRecords, prependNodeId(next.node(), new long[] { 42L }), new ReusableRecordsAllocator(60, record));
nodeRecord.setLabelField(dynamicPointer(newRecords), newRecords);
tx.create(nodeRecord);
}
});
// when
ConsistencySummaryStatistics stats = check();
// then
on(stats).verify(RecordType.NODE_DYNAMIC_LABEL, 1).andThatsAllFolks();
}
use of org.neo4j.consistency.report.ConsistencySummaryStatistics in project neo4j by neo4j.
the class FullCheckIntegrationTest method shouldReportDuplicateConstraintReferences.
@Test
public void shouldReportDuplicateConstraintReferences() 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) ruleId1);
IndexRule rule2 = constraintIndexRule(ruleId2, labelId, propertyKeyId, DESCRIPTOR, (long) ruleId1);
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, 4).andThatsAllFolks();
}
use of org.neo4j.consistency.report.ConsistencySummaryStatistics in project neo4j by neo4j.
the class FullCheckIntegrationTest method shouldReportRelationshipGroupChainInconsistencies.
@Test
public void shouldReportRelationshipGroupChainInconsistencies() 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();
tx.create(inUse(new NodeRecord(node, true, group, NO_NEXT_PROPERTY.intValue())));
tx.create(withOwner(withNext(inUse(new RelationshipGroupRecord(group, C)), group + 1), node));
}
});
// when
ConsistencySummaryStatistics stats = check();
// then
on(stats).verify(RecordType.RELATIONSHIP_GROUP, 1).andThatsAllFolks();
}
Aggregations