use of org.neo4j.io.pagecache.tracing.DefaultPageCacheTracer in project neo4j by neo4j.
the class GBPTreeSingleWriterTest method trackPageCacheAccessOnClose.
@Test
void trackPageCacheAccessOnClose() throws IOException {
var pageCacheTracer = new DefaultPageCacheTracer();
var cursorContext = new CursorContext(pageCacheTracer.createPageCursorTracer("trackPageCacheAccessOnClose"));
assertZeroCursor(cursorContext);
try (var gbpTree = new GBPTreeBuilder<>(pageCache, directory.file("index"), layout).build();
var treeWriter = gbpTree.writer(0, cursorContext)) {
// empty, we check that closing everything register unpins event
}
PageCursorTracer cursorTracer = cursorContext.getCursorTracer();
assertThat(cursorTracer.pins()).isEqualTo(1);
assertThat(cursorTracer.hits()).isEqualTo(1);
assertThat(cursorTracer.unpins()).isEqualTo(1);
assertThat(cursorTracer.faults()).isEqualTo(0);
}
use of org.neo4j.io.pagecache.tracing.DefaultPageCacheTracer in project neo4j by neo4j.
the class GBPTreeSingleWriterTest method trackPageCacheAccessOnRemove.
@Test
void trackPageCacheAccessOnRemove() throws IOException {
var pageCacheTracer = new DefaultPageCacheTracer();
var cursorContext = new CursorContext(pageCacheTracer.createPageCursorTracer("trackPageCacheAccessOnRemove"));
try (var gbpTree = new GBPTreeBuilder<>(pageCache, directory.file("index"), layout).build();
var treeWriter = gbpTree.writer(0, cursorContext)) {
treeWriter.put(new MutableLong(0), new MutableLong(0));
var cursorTracer = cursorContext.getCursorTracer();
assertThat(cursorTracer.pins()).isEqualTo(5);
assertThat(cursorTracer.unpins()).isEqualTo(4);
assertThat(cursorTracer.hits()).isEqualTo(4);
assertThat(cursorTracer.faults()).isEqualTo(1);
cursorTracer.reportEvents();
assertZeroCursor(cursorContext);
// we are on the same page and we do not expect any cursor events to be registered
treeWriter.remove(new MutableLong(0));
assertZeroCursor(cursorContext);
}
}
use of org.neo4j.io.pagecache.tracing.DefaultPageCacheTracer in project neo4j by neo4j.
the class GBPTreeTest method trackPageCacheAccessOnVisit.
@Test
void trackPageCacheAccessOnVisit() throws IOException {
var pageCacheTracer = new DefaultPageCacheTracer();
try (PageCache pageCache = createPageCache(defaultPageSize);
var tree = index(pageCache).with(pageCacheTracer).build()) {
var cursorContext = new CursorContext(pageCacheTracer.createPageCursorTracer("traverseTree"));
tree.visit(new GBPTreeVisitor.Adaptor<>(), cursorContext);
var cursorTracer = cursorContext.getCursorTracer();
assertThat(cursorTracer.pins()).isEqualTo(5);
assertThat(cursorTracer.unpins()).isEqualTo(5);
assertThat(cursorTracer.hits()).isEqualTo(5);
}
}
use of org.neo4j.io.pagecache.tracing.DefaultPageCacheTracer in project neo4j by neo4j.
the class RecordStoreVersionCheckTest method tracePageCacheAccessOnStoreVersionAccessConstruction.
@Test
void tracePageCacheAccessOnStoreVersionAccessConstruction() throws IOException {
var pageCacheTracer = new DefaultPageCacheTracer();
var cursorContext = new CursorContext(pageCacheTracer.createPageCursorTracer("tracePageCacheAccessOnStoreVersionAccessConstruction"));
Path neoStore = emptyFile(fileSystem);
String storeVersion = "V1";
long v1 = MetaDataStore.versionStringToLong(storeVersion);
MetaDataStore.setRecord(pageCache, neoStore, MetaDataStore.Position.STORE_VERSION, v1, databaseLayout.getDatabaseName(), NULL);
var versionCheck = newStoreVersionCheck();
assertEquals(storeVersion, versionCheck.storeVersion(cursorContext).get());
PageCursorTracer cursorTracer = cursorContext.getCursorTracer();
assertThat(cursorTracer.pins()).isOne();
assertThat(cursorTracer.unpins()).isOne();
assertThat(cursorTracer.faults()).isOne();
}
use of org.neo4j.io.pagecache.tracing.DefaultPageCacheTracer in project neo4j by neo4j.
the class RecordStoreVersionCheckTest method tracePageCacheAccessOnCheckUpgradable.
@Test
void tracePageCacheAccessOnCheckUpgradable() throws IOException {
Path neoStore = emptyFile(fileSystem);
String storeVersion = "V1";
long v1 = MetaDataStore.versionStringToLong(storeVersion);
MetaDataStore.setRecord(pageCache, neoStore, MetaDataStore.Position.STORE_VERSION, v1, databaseLayout.getDatabaseName(), NULL);
RecordStoreVersionCheck storeVersionCheck = newStoreVersionCheck();
var pageCacheTracer = new DefaultPageCacheTracer();
var cursorContext = new CursorContext(pageCacheTracer.createPageCursorTracer("tracePageCacheAccessOnCheckUpgradable"));
StoreVersionCheck.Result result = storeVersionCheck.checkUpgrade(storeVersion, cursorContext);
assertTrue(result.outcome.isSuccessful());
PageCursorTracer cursorTracer = cursorContext.getCursorTracer();
assertThat(cursorTracer.pins()).isOne();
assertThat(cursorTracer.unpins()).isOne();
assertThat(cursorTracer.faults()).isOne();
}
Aggregations