Search in sources :

Example 36 with PageCursorTracer

use of org.neo4j.io.pagecache.tracing.cursor.PageCursorTracer 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();
}
Also used : Path(java.nio.file.Path) StoreVersionCheck(org.neo4j.storageengine.api.StoreVersionCheck) PageCursorTracer(org.neo4j.io.pagecache.tracing.cursor.PageCursorTracer) CursorContext(org.neo4j.io.pagecache.context.CursorContext) DefaultPageCacheTracer(org.neo4j.io.pagecache.tracing.DefaultPageCacheTracer) Test(org.junit.jupiter.api.Test)

Example 37 with PageCursorTracer

use of org.neo4j.io.pagecache.tracing.cursor.PageCursorTracer in project neo4j by neo4j.

the class LuceneFulltextIndexTest method assertZeroTracer.

private void assertZeroTracer(CursorContext cursorContext) {
    PageCursorTracer cursorTracer = cursorContext.getCursorTracer();
    assertThat(cursorTracer.pins()).isZero();
    assertThat(cursorTracer.unpins()).isZero();
    assertThat(cursorTracer.hits()).isZero();
    assertThat(cursorTracer.faults()).isZero();
}
Also used : PageCursorTracer(org.neo4j.io.pagecache.tracing.cursor.PageCursorTracer)

Example 38 with PageCursorTracer

use of org.neo4j.io.pagecache.tracing.cursor.PageCursorTracer in project neo4j by neo4j.

the class NeoStoresTest method tracePageCacheAccessOnTransactionCommittedCall.

@Test
void tracePageCacheAccessOnTransactionCommittedCall() {
    StoreFactory factory = getStoreFactory(Config.defaults(), databaseLayout, fs, LOG_PROVIDER);
    try (NeoStores neoStore = factory.openAllNeoStores(true)) {
        MetaDataStore store = neoStore.getMetaDataStore();
        var cacheTracer = new DefaultPageCacheTracer();
        var cursorContext = new CursorContext(cacheTracer.createPageCursorTracer("tracePageCacheAccessOnTransactionCommittedCall"));
        store.transactionCommitted(42, 6666, BASE_TX_COMMIT_TIMESTAMP, cursorContext);
        PageCursorTracer cursorTracer = cursorContext.getCursorTracer();
        assertEquals(1, cursorTracer.pins());
        assertEquals(1, cursorTracer.hits());
        assertEquals(1, cursorTracer.unpins());
    }
}
Also used : PageCursorTracer(org.neo4j.io.pagecache.tracing.cursor.PageCursorTracer) CursorContext(org.neo4j.io.pagecache.context.CursorContext) DefaultPageCacheTracer(org.neo4j.io.pagecache.tracing.DefaultPageCacheTracer) Test(org.junit.jupiter.api.Test)

Example 39 with PageCursorTracer

use of org.neo4j.io.pagecache.tracing.cursor.PageCursorTracer in project neo4j by neo4j.

the class NeoStoresIT method tracePageCacheAccessOnTokenReads.

@Test
void tracePageCacheAccessOnTokenReads() {
    var storageEngine = db.getDependencyResolver().resolveDependency(RecordStorageEngine.class);
    var neoStores = storageEngine.testAccessNeoStores();
    var propertyKeys = neoStores.getPropertyKeyTokenStore();
    try (Transaction transaction = db.beginTx()) {
        var node = transaction.createNode();
        node.setProperty("a", "b");
        transaction.commit();
    }
    var cursorContext = new CursorContext(new DefaultPageCacheTracer().createPageCursorTracer("tracePageCacheAccessOnTokenReads"));
    propertyKeys.getAllReadableTokens(cursorContext);
    PageCursorTracer cursorTracer = cursorContext.getCursorTracer();
    assertEquals(22, cursorTracer.hits());
    assertEquals(22, cursorTracer.pins());
    assertEquals(22, cursorTracer.unpins());
}
Also used : PageCursorTracer(org.neo4j.io.pagecache.tracing.cursor.PageCursorTracer) Transaction(org.neo4j.graphdb.Transaction) CursorContext(org.neo4j.io.pagecache.context.CursorContext) DefaultPageCacheTracer(org.neo4j.io.pagecache.tracing.DefaultPageCacheTracer) Test(org.junit.jupiter.api.Test)

Example 40 with PageCursorTracer

use of org.neo4j.io.pagecache.tracing.cursor.PageCursorTracer 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());
}
Also used : PageCursorTracer(org.neo4j.io.pagecache.tracing.cursor.PageCursorTracer) Transaction(org.neo4j.graphdb.Transaction) CursorContext(org.neo4j.io.pagecache.context.CursorContext) DefaultPageCacheTracer(org.neo4j.io.pagecache.tracing.DefaultPageCacheTracer) Test(org.junit.jupiter.api.Test)

Aggregations

PageCursorTracer (org.neo4j.io.pagecache.tracing.cursor.PageCursorTracer)47 Test (org.junit.jupiter.api.Test)30 CursorContext (org.neo4j.io.pagecache.context.CursorContext)27 DefaultPageCacheTracer (org.neo4j.io.pagecache.tracing.DefaultPageCacheTracer)26 Transaction (org.neo4j.graphdb.Transaction)11 InternalTransaction (org.neo4j.kernel.impl.coreapi.InternalTransaction)5 Path (java.nio.file.Path)2 MutableLong (org.apache.commons.lang3.mutable.MutableLong)2 IndexSample (org.neo4j.kernel.api.index.IndexSample)2 NodeRecord (org.neo4j.kernel.impl.store.record.NodeRecord)2 GraphDatabaseAPI (org.neo4j.kernel.internal.GraphDatabaseAPI)2 Test (org.junit.Test)1 ParameterizedTest (org.junit.jupiter.params.ParameterizedTest)1 MethodSource (org.junit.jupiter.params.provider.MethodSource)1 DatabaseManagementService (org.neo4j.dbms.api.DatabaseManagementService)1 KernelTransaction (org.neo4j.kernel.api.KernelTransaction)1 DynamicRecord (org.neo4j.kernel.impl.store.record.DynamicRecord)1 PropertyBlock (org.neo4j.kernel.impl.store.record.PropertyBlock)1 ExternalStoreId (org.neo4j.storageengine.api.ExternalStoreId)1 IndexEntryUpdate (org.neo4j.storageengine.api.IndexEntryUpdate)1