use of org.neo4j.io.pagecache.tracing.DefaultPageCacheTracer in project neo4j by neo4j.
the class NeoStoresIT method tracePageCacheAccessOnInUseCheck.
@Test
void tracePageCacheAccessOnInUseCheck() {
var storageEngine = db.getDependencyResolver().resolveDependency(RecordStorageEngine.class);
var neoStores = storageEngine.testAccessNeoStores();
var propertyStore = neoStores.getPropertyStore();
try (Transaction transaction = db.beginTx()) {
var node = transaction.createNode();
node.setProperty("a", "b");
transaction.commit();
}
var cursorContext = new CursorContext(new DefaultPageCacheTracer().createPageCursorTracer("tracePageCacheAccessOnInUseCheck"));
propertyStore.isInUse(1L, cursorContext);
PageCursorTracer cursorTracer = cursorContext.getCursorTracer();
assertEquals(1, cursorTracer.hits());
assertEquals(1, cursorTracer.pins());
assertEquals(1, cursorTracer.unpins());
}
use of org.neo4j.io.pagecache.tracing.DefaultPageCacheTracer in project neo4j by neo4j.
the class NeoStoresIT method tracePageCacheAccessOnGetRecord.
@Test
void tracePageCacheAccessOnGetRecord() {
var storageEngine = db.getDependencyResolver().resolveDependency(RecordStorageEngine.class);
var neoStores = storageEngine.testAccessNeoStores();
var nodeStore = neoStores.getNodeStore();
long nodeId;
try (Transaction transaction = db.beginTx()) {
var node = transaction.createNode();
node.setProperty("a", "b");
nodeId = node.getId();
transaction.commit();
}
var cursorContext = new CursorContext(new DefaultPageCacheTracer().createPageCursorTracer("tracePageCacheAccessOnGetRecord"));
nodeStore.getRecord(nodeId, new NodeRecord(nodeId), RecordLoad.NORMAL, cursorContext);
PageCursorTracer cursorTracer = cursorContext.getCursorTracer();
assertEquals(1, cursorTracer.hits());
assertEquals(1, cursorTracer.pins());
assertEquals(1, cursorTracer.unpins());
}
use of org.neo4j.io.pagecache.tracing.DefaultPageCacheTracer in project neo4j by neo4j.
the class IndexAccessorTests method dropShouldNotFlushContent.
@Test
void dropShouldNotFlushContent() throws IOException {
// given
accessor.close();
DefaultPageCacheTracer tracer = new DefaultPageCacheTracer();
try (PageCache pageCache = pageCacheExtension.getPageCache(fs, PageCacheConfig.config().withTracer(tracer))) {
accessor = createAccessor(pageCache);
long baseline = tracer.flushes();
accessor.force(NULL);
long preDrop = tracer.flushes();
assertThat(preDrop).isGreaterThan(baseline);
// when
accessor.drop();
// then
long postDrop = tracer.flushes();
assertEquals(preDrop, postDrop);
}
}
use of org.neo4j.io.pagecache.tracing.DefaultPageCacheTracer in project neo4j by neo4j.
the class MetaDataStoreTest method tracePageCacheAccessOnSetRecord.
@Test
void tracePageCacheAccessOnSetRecord() throws IOException {
var cacheTracer = new DefaultPageCacheTracer();
var cursorContext = new CursorContext(cacheTracer.createPageCursorTracer("tracePageCacheAccessOnSetRecord"));
try (var metaDataStore = newMetaDataStore()) {
MetaDataStore.setRecord(pageCache, metaDataStore.getStorageFile(), MetaDataStore.Position.RANDOM_NUMBER, 3, databaseLayout.getDatabaseName(), cursorContext);
PageCursorTracer cursorTracer = cursorContext.getCursorTracer();
assertThat(cursorTracer.pins()).isOne();
assertThat(cursorTracer.unpins()).isOne();
assertThat(cursorTracer.hits()).isOne();
}
}
use of org.neo4j.io.pagecache.tracing.DefaultPageCacheTracer in project neo4j by neo4j.
the class MetaDataStoreTest method tracePageCacheAssessOnSetStoreId.
@Test
void tracePageCacheAssessOnSetStoreId() throws IOException {
var cacheTracer = new DefaultPageCacheTracer();
var cursorContext = new CursorContext(cacheTracer.createPageCursorTracer("tracePageCacheAssessOnSetStoreId"));
try (var metaDataStore = newMetaDataStore()) {
var storeId = new StoreId(1, 2, 3, 4, 5);
MetaDataStore.setStoreId(pageCache, metaDataStore.getStorageFile(), storeId, 6, 7, databaseLayout.getDatabaseName(), cursorContext);
PageCursorTracer cursorTracer = cursorContext.getCursorTracer();
assertThat(cursorTracer.pins()).isEqualTo(7);
assertThat(cursorTracer.unpins()).isEqualTo(7);
assertThat(cursorTracer.hits()).isEqualTo(7);
}
}
Aggregations