use of org.neo4j.memory.MemoryPools in project neo4j by neo4j.
the class ConsistencyCheckServiceIntegrationTest method tracePageCacheAccessOnConsistencyCheck.
@Test
void tracePageCacheAccessOnConsistencyCheck() throws ConsistencyCheckIncompleteException {
prepareDbWithDeletedRelationshipPartOfTheChain();
ConsistencyCheckService service = new ConsistencyCheckService(new Date());
var pageCacheTracer = new DefaultPageCacheTracer();
fixture.close();
JobScheduler jobScheduler = JobSchedulerFactory.createScheduler();
ConfiguringPageCacheFactory pageCacheFactory = new ConfiguringPageCacheFactory(testDirectory.getFileSystem(), Config.defaults(GraphDatabaseSettings.pagecache_memory, "8m"), pageCacheTracer, NullLog.getInstance(), jobScheduler, Clocks.nanoClock(), new MemoryPools(false));
try (Lifespan life = new Lifespan(jobScheduler);
PageCache pageCache = pageCacheFactory.getOrCreatePageCache()) {
var result = service.runFullConsistencyCheck(fixture.databaseLayout(), Config.defaults(settings()), ProgressMonitorFactory.NONE, NullLogProvider.getInstance(), testDirectory.getFileSystem(), pageCache, false, ConsistencyFlags.DEFAULT, pageCacheTracer, INSTANCE);
assertFalse(result.isSuccessful());
assertThat(pageCacheTracer.pins()).isGreaterThanOrEqualTo(74);
assertThat(pageCacheTracer.unpins()).isGreaterThanOrEqualTo(74);
assertThat(pageCacheTracer.hits()).isGreaterThanOrEqualTo(35);
assertThat(pageCacheTracer.faults()).isGreaterThanOrEqualTo(39);
}
}
use of org.neo4j.memory.MemoryPools in project neo4j by neo4j.
the class FullCheckFulltextIndexEmptyDocs method check.
private ConsistencyCheckService.Result check(Config config, DatabaseLayout layout) throws Exception {
JobScheduler jobScheduler = JobSchedulerFactory.createInitialisedScheduler();
ConfiguringPageCacheFactory pageCacheFactory = new ConfiguringPageCacheFactory(fs, config, NULL, NullLog.getInstance(), jobScheduler, Clocks.nanoClock(), new MemoryPools(config.get(memory_tracking)));
PageCache pageCache = pageCacheFactory.getOrCreatePageCache();
ConsistencyCheckService.Result result;
try {
result = new ConsistencyCheckService().runFullConsistencyCheck(layout, config, NONE, NullLogProvider.getInstance(), fs, pageCache, DebugContext.NO_DEBUG, layout.databaseDirectory(), DEFAULT, NULL, INSTANCE);
} finally {
pageCache.close();
jobScheduler.close();
}
return result;
}
use of org.neo4j.memory.MemoryPools in project neo4j by neo4j.
the class ConfiguringPageCacheFactoryTest method createPageCacheWithoutPreallocationEnabled.
@Test
void createPageCacheWithoutPreallocationEnabled() throws IOException {
Config config = Config.defaults(preallocate_store_files, false);
ConfiguringPageCacheFactory factory = new ConfiguringPageCacheFactory(fs, config, PageCacheTracer.NULL, NullLog.getInstance(), jobScheduler, Clocks.nanoClock(), new MemoryPools());
Path testFile = testDirectory.createFile("a");
try (var cache = factory.getOrCreatePageCache();
var file = cache.map(testFile, PAGE_SIZE, "foo");
var io = file.io(1024, PF_SHARED_WRITE_LOCK, NULL)) {
int bigPageToExpand = 20021;
assertDoesNotThrow(() -> io.next(bigPageToExpand));
assertEquals(bigPageToExpand, file.getLastPageId());
}
}
use of org.neo4j.memory.MemoryPools in project neo4j by neo4j.
the class ForsetiMemoryTrackingTest method setUp.
@BeforeEach
void setUp() {
memoryPool = new MemoryPools().pool(MemoryGroup.TRANSACTION, 0L, null);
memoryTracker = new LocalMemoryTracker(memoryPool);
forsetiLockManager = new ForsetiLockManager(Config.defaults(), Clocks.nanoClock(), ResourceTypes.values());
}
use of org.neo4j.memory.MemoryPools in project neo4j by neo4j.
the class HeapTrackingLongHashSetTest method setUp.
@BeforeEach
void setUp() {
memoryPool = new MemoryPools().pool(MemoryGroup.TRANSACTION, 0L, null);
memoryTracker = new LocalMemoryTracker(memoryPool);
}
Aggregations