use of org.neo4j.io.pagecache.tracing.DefaultPageCacheTracer in project neo4j by neo4j.
the class MetaDataStoreTest method tracePageCacheAccessOnGetRecord.
@Test
void tracePageCacheAccessOnGetRecord() throws IOException {
var cacheTracer = new DefaultPageCacheTracer();
var cursorContext = new CursorContext(cacheTracer.createPageCursorTracer("tracePageCacheAccessOnGetRecord"));
try (var metaDataStore = newMetaDataStore()) {
MetaDataStore.getRecord(pageCache, metaDataStore.getStorageFile(), MetaDataStore.Position.RANDOM_NUMBER, 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 tracePageCacheAssessOnIncrementAndGetVersion.
@Test
void tracePageCacheAssessOnIncrementAndGetVersion() {
var cacheTracer = new DefaultPageCacheTracer();
var cursorContext = new CursorContext(cacheTracer.createPageCursorTracer("tracePageCacheAssessOnIncrementAndGetVersion"));
try (var metaDataStore = newMetaDataStore()) {
metaDataStore.incrementAndGetVersion(cursorContext);
PageCursorTracer cursorTracer = cursorContext.getCursorTracer();
assertThat(cursorTracer.pins()).isEqualTo(1);
assertThat(cursorTracer.unpins()).isEqualTo(1);
assertThat(cursorTracer.hits()).isEqualTo(1);
}
}
use of org.neo4j.io.pagecache.tracing.DefaultPageCacheTracer in project neo4j by neo4j.
the class NodeCheckerIT method setUp.
@BeforeEach
void setUp() throws Exception {
pageCacheTracer = new DefaultPageCacheTracer();
var label = label("any");
var propertyName = "property";
try (var tx = database.beginTx()) {
var node = tx.createNode(label);
node.setProperty(propertyName, "nodeValue");
nodeId = node.getId();
tx.commit();
}
try (var tx = database.beginTx()) {
tx.schema().indexFor(label).on(propertyName).withName(INDEX_NAME).create();
tx.commit();
}
try (var tx = database.beginTx()) {
tx.schema().awaitIndexesOnline(10, MINUTES);
}
prepareContext();
}
use of org.neo4j.io.pagecache.tracing.DefaultPageCacheTracer in project neo4j by neo4j.
the class DeleteDuplicateNodesStepTest method tracePageCacheAccessOnNodeDeduplication.
@Test
void tracePageCacheAccessOnNodeDeduplication() throws Exception {
// given
Ids[] ids = new Ids[10];
DataImporter.Monitor monitor = new DataImporter.Monitor();
for (int i = 0; i < ids.length; i++) {
ids[i] = createNode(monitor, neoStores, 1, 1);
}
long[] duplicateNodeIds = randomNodes(ids);
SimpleStageControl control = new SimpleStageControl();
var cacheTracer = new DefaultPageCacheTracer();
try (DeleteDuplicateNodesStep step = new DeleteDuplicateNodesStep(control, Configuration.DEFAULT, iterator(duplicateNodeIds), neoStores.getNodeStore(), neoStores.getPropertyStore(), monitor, cacheTracer)) {
control.steps(step);
startAndAwaitCompletionOf(step);
}
control.assertHealthy();
// at least 2 events per node is expected since property size is dynamic random thingy
int expectedEventNumber = duplicateNodeIds.length * 2;
assertThat(cacheTracer.pins()).isGreaterThanOrEqualTo(expectedEventNumber);
assertThat(cacheTracer.unpins()).isGreaterThanOrEqualTo(expectedEventNumber);
assertThat(cacheTracer.hits()).isGreaterThanOrEqualTo(expectedEventNumber);
}
use of org.neo4j.io.pagecache.tracing.DefaultPageCacheTracer in project neo4j by neo4j.
the class MuninnPageCacheTest method flushSequentialPagesOnPageFileFlushWithBuffers.
@Test
void flushSequentialPagesOnPageFileFlushWithBuffers() throws IOException {
assumeFalse(DISABLED_BUFFER_FACTORY.equals(fixture.getBufferFactory()));
var pageCacheTracer = new DefaultPageCacheTracer();
try (MuninnPageCache pageCache = createPageCache(fs, 4, pageCacheTracer);
PagedFile pagedFile = map(pageCache, file("a"), (int) ByteUnit.kibiBytes(8))) {
try (PageCursor cursor = pagedFile.io(1, PF_SHARED_WRITE_LOCK, NULL)) {
assertTrue(cursor.next());
cursor.putLong(1);
}
try (PageCursor cursor = pagedFile.io(2, PF_SHARED_WRITE_LOCK, NULL)) {
assertTrue(cursor.next());
cursor.putLong(1);
}
pagedFile.flushAndForce();
assertEquals(2, pageCacheTracer.flushes());
assertEquals(0, pageCacheTracer.merges());
}
}
Aggregations