use of org.neo4j.consistency.checking.cache.DefaultCacheAccess in project neo4j by neo4j.
the class FullCheck method execute.
ConsistencySummaryStatistics execute(DirectStoreAccess stores, Log log, Monitor reportMonitor) throws ConsistencyCheckIncompleteException {
ConsistencySummaryStatistics summary = new ConsistencySummaryStatistics();
InconsistencyReport report = new InconsistencyReport(new InconsistencyMessageLogger(log), summary);
OwnerCheck ownerCheck = new OwnerCheck(checkPropertyOwners);
CountsBuilderDecorator countsBuilder = new CountsBuilderDecorator(stores.nativeStores());
CheckDecorator decorator = new CheckDecorator.ChainCheckDecorator(ownerCheck, countsBuilder);
CacheAccess cacheAccess = new DefaultCacheAccess(statistics.getCounts(), threads);
RecordAccess records = recordAccess(stores.nativeStores(), cacheAccess);
execute(stores, decorator, records, report, cacheAccess, reportMonitor);
ownerCheck.scanForOrphanChains(progressFactory);
if (checkGraph) {
CountsAccessor countsAccessor = stores.nativeStores().getCounts();
if (countsAccessor instanceof CountsTracker) {
CountsTracker tracker = (CountsTracker) countsAccessor;
try {
tracker.start();
} catch (Exception e) {
// let's hope it was already started :)
}
}
countsBuilder.checkCounts(countsAccessor, new ConsistencyReporter(records, report), progressFactory);
}
if (!summary.isConsistent()) {
log.warn("Inconsistencies found: " + summary);
}
return summary;
}
use of org.neo4j.consistency.checking.cache.DefaultCacheAccess in project neo4j by neo4j.
the class CountsStateTest method setUp.
@BeforeEach
void setUp() {
cacheAccess = new DefaultCacheAccess(HEAP.newByteArray(HIGH_NODE_ID, new byte[MAX_SLOT_BITS], INSTANCE), Counts.NONE, 1);
cacheAccess.setCacheSlotSizes(DEFAULT_SLOT_SIZES);
countsState = new CountsState(HIGH_TOKEN_ID, HIGH_TOKEN_ID, HIGH_NODE_ID, cacheAccess, INSTANCE);
noConsistencyReporter = mock(ConsistencyReporter.class);
when(noConsistencyReporter.forCounts(any())).thenReturn(mock(ConsistencyReport.CountsConsistencyReport.class));
inconsistencyReporter = mock(ConsistencyReporter.class);
when(inconsistencyReporter.forCounts(any())).thenReturn(mock(ConsistencyReport.CountsConsistencyReport.class));
race = new Race().withEndCondition(() -> false);
}
use of org.neo4j.consistency.checking.cache.DefaultCacheAccess 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());
}
use of org.neo4j.consistency.checking.cache.DefaultCacheAccess in project neo4j by neo4j.
the class CheckerTestBase method setUpDb.
@BeforeEach
void setUpDb() throws Exception {
TestDatabaseManagementServiceBuilder builder = new TestDatabaseManagementServiceBuilder(directory.homePath());
builder.setFileSystem(directory.getFileSystem());
dbms = builder.build();
db = (GraphDatabaseAPI) dbms.database(GraphDatabaseSettings.DEFAULT_DATABASE_NAME);
// Create our tokens
Kernel kernel = db.getDependencyResolver().resolveDependency(Kernel.class);
try (KernelTransaction tx = kernel.beginTransaction(KernelTransaction.Type.EXPLICIT, LoginContext.AUTH_DISABLED)) {
initialData(tx);
tx.commit();
}
DependencyResolver dependencies = db.getDependencyResolver();
neoStores = dependencies.resolveDependency(RecordStorageEngine.class).testAccessNeoStores();
nodeStore = neoStores.getNodeStore();
relationshipGroupStore = neoStores.getRelationshipGroupStore();
propertyStore = neoStores.getPropertyStore();
relationshipStore = neoStores.getRelationshipStore();
schemaStore = neoStores.getSchemaStore();
tokenHolders = dependencies.resolveDependency(TokenHolders.class);
schemaStorage = new SchemaStorage(schemaStore, tokenHolders, neoStores.getMetaDataStore());
cacheAccess = new DefaultCacheAccess(NumberArrayFactories.HEAP.newDynamicByteArray(10_000, new byte[MAX_BYTES], INSTANCE), Counts.NONE, NUMBER_OF_THREADS);
cacheAccess.setCacheSlotSizes(DEFAULT_SLOT_SIZES);
pageCache = dependencies.resolveDependency(PageCache.class);
}
Aggregations