Search in sources :

Example 1 with PageCacheConfig

use of org.neo4j.test.rule.PageCacheConfig in project neo4j by neo4j.

the class GBPTreeTest method skipFlushingPageFileOnCloseWhenPageFileMarkForDeletion.

@Test
void skipFlushingPageFileOnCloseWhenPageFileMarkForDeletion() throws IOException {
    var tracer = new DefaultPageCacheTracer();
    PageCacheConfig config = config().withTracer(tracer);
    long initialPins = tracer.pins();
    try (PageCache pageCache = pageCacheExtension.getPageCache(fileSystem, config);
        GBPTree<MutableLong, MutableLong> tree = index(pageCache).with(RecoveryCleanupWorkCollector.ignore()).with(tracer).build()) {
        List<PagedFile> pagedFiles = pageCache.listExistingMappings();
        assertThat(pagedFiles).hasSize(1);
        long flushesBefore = tracer.flushes();
        PagedFile indexPageFile = pagedFiles.get(0);
        indexPageFile.setDeleteOnClose(true);
        tree.close();
        assertEquals(flushesBefore, tracer.flushes());
        assertEquals(tracer.pins(), tracer.unpins());
        assertThat(tracer.pins()).isGreaterThan(initialPins);
        assertThat(tracer.pins()).isGreaterThan(1);
    }
}
Also used : MutableLong(org.apache.commons.lang3.mutable.MutableLong) PagedFile(org.neo4j.io.pagecache.PagedFile) DelegatingPagedFile(org.neo4j.io.pagecache.DelegatingPagedFile) PageCacheConfig(org.neo4j.test.rule.PageCacheConfig) PageCache(org.neo4j.io.pagecache.PageCache) DelegatingPageCache(org.neo4j.io.pagecache.DelegatingPageCache) DefaultPageCacheTracer(org.neo4j.io.pagecache.tracing.DefaultPageCacheTracer) Test(org.junit.jupiter.api.Test)

Example 2 with PageCacheConfig

use of org.neo4j.test.rule.PageCacheConfig in project neo4j by neo4j.

the class GBPTreeFormatTest method setup.

@Before
public void setup() {
    allKeys = new ArrayList<>();
    allKeys.addAll(initialKeys);
    allKeys.addAll(keysToAdd);
    allKeys.sort(Long::compare);
    PageCacheConfig overriddenConfig = PageCacheConfig.config().withPageSize(pageSize);
    if (pageSize == PAGE_SIZE_4M) {
        overriddenConfig.withMemory("16MiB");
    }
    pageCache = pageCacheRule.getPageCache(globalFs, overriddenConfig);
}
Also used : PageCacheConfig(org.neo4j.test.rule.PageCacheConfig) Before(org.junit.Before)

Aggregations

PageCacheConfig (org.neo4j.test.rule.PageCacheConfig)2 MutableLong (org.apache.commons.lang3.mutable.MutableLong)1 Before (org.junit.Before)1 Test (org.junit.jupiter.api.Test)1 DelegatingPageCache (org.neo4j.io.pagecache.DelegatingPageCache)1 DelegatingPagedFile (org.neo4j.io.pagecache.DelegatingPagedFile)1 PageCache (org.neo4j.io.pagecache.PageCache)1 PagedFile (org.neo4j.io.pagecache.PagedFile)1 DefaultPageCacheTracer (org.neo4j.io.pagecache.tracing.DefaultPageCacheTracer)1