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);
}
}
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);
}
Aggregations