Search in sources :

Example 11 with StoreAccess

use of org.neo4j.kernel.impl.store.StoreAccess in project neo4j by neo4j.

the class ExecutionOrderIntegrationTest method shouldRunChecksInSingleThreadedPass.

@Test
public void shouldRunChecksInSingleThreadedPass() throws Exception {
    // given
    StoreAccess store = fixture.directStoreAccess().nativeStores();
    int threads = defaultConsistencyCheckThreadsNumber();
    CacheAccess cacheAccess = new DefaultCacheAccess(new DefaultCounts(threads), threads);
    RecordAccess access = FullCheck.recordAccess(store, cacheAccess);
    FullCheck singlePass = new FullCheck(getTuningConfiguration(), ProgressMonitorFactory.NONE, Statistics.NONE, threads);
    ConsistencySummaryStatistics singlePassSummary = new ConsistencySummaryStatistics();
    InconsistencyLogger logger = mock(InconsistencyLogger.class);
    InvocationLog singlePassChecks = new InvocationLog();
    // when
    singlePass.execute(fixture.directStoreAccess(), new LogDecorator(singlePassChecks), access, new InconsistencyReport(logger, singlePassSummary), cacheAccess, NO_MONITOR);
    // then
    verifyZeroInteractions(logger);
    assertEquals("Expected no inconsistencies in single pass.", 0, singlePassSummary.getTotalInconsistencyCount());
}
Also used : DefaultCounts(org.neo4j.consistency.statistics.DefaultCounts) RecordAccess(org.neo4j.consistency.store.RecordAccess) StoreAccess(org.neo4j.kernel.impl.store.StoreAccess) InconsistencyReport(org.neo4j.consistency.report.InconsistencyReport) CacheAccess(org.neo4j.consistency.checking.cache.CacheAccess) DefaultCacheAccess(org.neo4j.consistency.checking.cache.DefaultCacheAccess) InconsistencyLogger(org.neo4j.consistency.report.InconsistencyLogger) DefaultCacheAccess(org.neo4j.consistency.checking.cache.DefaultCacheAccess) ConsistencySummaryStatistics(org.neo4j.consistency.report.ConsistencySummaryStatistics) Test(org.junit.Test)

Example 12 with StoreAccess

use of org.neo4j.kernel.impl.store.StoreAccess 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();
}
Also used : DirectStoreAccess(org.neo4j.kernel.api.direct.DirectStoreAccess) StoreAccess(org.neo4j.kernel.impl.store.StoreAccess) RelationshipTypeTokenRecord(org.neo4j.kernel.impl.store.record.RelationshipTypeTokenRecord) ConsistencySummaryStatistics(org.neo4j.consistency.report.ConsistencySummaryStatistics) Test(org.junit.Test)

Example 13 with StoreAccess

use of org.neo4j.kernel.impl.store.StoreAccess in project neo4j by neo4j.

the class FullCheckIntegrationTest method shouldReportPropertyKeyNameInconsistencies.

@Test
public void shouldReportPropertyKeyNameInconsistencies() throws Exception {
    // given
    final Reference<Integer> inconsistentName = new Reference<>();
    fixture.apply(new GraphStoreFixture.Transaction() {

        @Override
        protected void transactionData(GraphStoreFixture.TransactionDataBuilder tx, GraphStoreFixture.IdGenerator next) {
            inconsistentName.set(next.propertyKey());
            tx.propertyKey(inconsistentName.get(), "FOO");
        }
    });
    StoreAccess access = fixture.directStoreAccess().nativeStores();
    DynamicRecord record = access.getPropertyKeyNameStore().getRecord(inconsistentName.get() + 1, access.getPropertyKeyNameStore().newRecord(), FORCE);
    record.setNextBlock(record.getId());
    access.getPropertyKeyNameStore().updateRecord(record);
    // when
    ConsistencySummaryStatistics stats = check();
    // then
    on(stats).verify(RecordType.PROPERTY_KEY_NAME, 1).andThatsAllFolks();
}
Also used : DynamicRecord(org.neo4j.kernel.impl.store.record.DynamicRecord) DirectStoreAccess(org.neo4j.kernel.api.direct.DirectStoreAccess) StoreAccess(org.neo4j.kernel.impl.store.StoreAccess) TransactionDataBuilder(org.neo4j.consistency.checking.GraphStoreFixture.TransactionDataBuilder) IdGenerator(org.neo4j.consistency.checking.GraphStoreFixture.IdGenerator) GraphStoreFixture(org.neo4j.consistency.checking.GraphStoreFixture) ConsistencySummaryStatistics(org.neo4j.consistency.report.ConsistencySummaryStatistics) Test(org.junit.Test)

Aggregations

StoreAccess (org.neo4j.kernel.impl.store.StoreAccess)13 DirectStoreAccess (org.neo4j.kernel.api.direct.DirectStoreAccess)10 ConsistencySummaryStatistics (org.neo4j.consistency.report.ConsistencySummaryStatistics)8 Test (org.junit.Test)7 File (java.io.File)3 GraphStoreFixture (org.neo4j.consistency.checking.GraphStoreFixture)3 IdGenerator (org.neo4j.consistency.checking.GraphStoreFixture.IdGenerator)3 TransactionDataBuilder (org.neo4j.consistency.checking.GraphStoreFixture.TransactionDataBuilder)3 AccessStatsKeepingStoreAccess (org.neo4j.consistency.statistics.AccessStatsKeepingStoreAccess)3 DefaultCounts (org.neo4j.consistency.statistics.DefaultCounts)3 PageCache (org.neo4j.io.pagecache.PageCache)3 LabelScanStore (org.neo4j.kernel.api.labelscan.LabelScanStore)3 StoreFactory (org.neo4j.kernel.impl.store.StoreFactory)3 DynamicRecord (org.neo4j.kernel.impl.store.record.DynamicRecord)3 GraphDatabaseAPI (org.neo4j.kernel.internal.GraphDatabaseAPI)3 IOException (java.io.IOException)2 AccessStatistics (org.neo4j.consistency.statistics.AccessStatistics)2 VerboseStatistics (org.neo4j.consistency.statistics.VerboseStatistics)2 Node (org.neo4j.graphdb.Node)2 Transaction (org.neo4j.graphdb.Transaction)2