use of org.neo4j.io.pagecache.tracing.DefaultPageCacheTracer in project neo4j by neo4j.
the class RecordStoreVersionCheckTest method tracePageCacheAccessOnConstruction.
@Test
void tracePageCacheAccessOnConstruction() throws IOException {
var pageCacheTracer = new DefaultPageCacheTracer();
Path neoStore = emptyFile(fileSystem);
String storeVersion = "V1";
long v1 = MetaDataStore.versionStringToLong(storeVersion);
MetaDataStore.setRecord(pageCache, neoStore, MetaDataStore.Position.STORE_VERSION, v1, databaseLayout.getDatabaseName(), NULL);
assertNotNull(newStoreVersionCheck(pageCacheTracer));
assertThat(pageCacheTracer.pins()).isOne();
assertThat(pageCacheTracer.unpins()).isOne();
assertThat(pageCacheTracer.faults()).isOne();
}
use of org.neo4j.io.pagecache.tracing.DefaultPageCacheTracer in project neo4j by neo4j.
the class StoreUpgraderInterruptionTestIT method tracePageCacheAccessOnIdStoreUpgrade.
@Test
public void tracePageCacheAccessOnIdStoreUpgrade() throws IOException, ConsistencyCheckIncompleteException {
MigrationTestUtils.prepareSampleLegacyDatabase(version, fs, workingDatabaseLayout.databaseDirectory(), prepareDirectory);
RecordStoreVersionCheck versionCheck = new RecordStoreVersionCheck(fs, pageCache, workingDatabaseLayout, NullLogProvider.getInstance(), Config.defaults(), NULL);
MigrationProgressMonitor progressMonitor = MigrationProgressMonitor.SILENT;
LogService logService = NullLogService.getInstance();
var idMigratorTracer = new DefaultPageCacheTracer();
var recordMigratorTracer = new DefaultPageCacheTracer();
IdGeneratorMigrator idMigrator = new IdGeneratorMigrator(fs, pageCache, CONFIG, idMigratorTracer);
assertTrue(checkNeoStoreHasFormatVersion(versionCheck, baselineFormat));
var migrator = new RecordStorageMigrator(fs, pageCache, CONFIG, logService, jobScheduler, recordMigratorTracer, batchImporterFactory, INSTANCE);
newUpgrader(versionCheck, progressMonitor, createIndexMigrator(), migrator, idMigrator).migrateIfNeeded(workingDatabaseLayout, false);
assertTrue(checkNeoStoreHasFormatVersion(versionCheck, successorFormat));
startStopDatabase(neo4jLayout.homeDirectory());
assertConsistentStore(workingDatabaseLayout);
assertEquals(43, idMigratorTracer.faults());
assertEquals(83, idMigratorTracer.hits());
assertEquals(126, idMigratorTracer.pins());
assertEquals(126, idMigratorTracer.unpins());
assertEquals(61, recordMigratorTracer.faults());
assertEquals(228, recordMigratorTracer.hits());
assertEquals(289, recordMigratorTracer.pins());
assertEquals(289, recordMigratorTracer.unpins());
}
use of org.neo4j.io.pagecache.tracing.DefaultPageCacheTracer in project neo4j by neo4j.
the class RelationshipCheckerIT method setUp.
@BeforeEach
void setUp() throws Exception {
pageCacheTracer = new DefaultPageCacheTracer();
var label = label("any");
var type = withName("type");
var propertyName = "property";
try (var tx = database.beginTx()) {
var start = tx.createNode(label);
var end = tx.createNode();
var rel = start.createRelationshipTo(end, type);
rel.setProperty(propertyName, "value");
relationshipId = rel.getId();
tx.commit();
}
try (var tx = database.beginTx()) {
tx.schema().indexFor(type).on(propertyName).withName(INDEX_NAME).withIndexType(IndexType.FULLTEXT).create();
tx.commit();
}
try (var transaction = database.beginTx()) {
transaction.schema().awaitIndexesOnline(10, MINUTES);
}
prepareContext();
}
use of org.neo4j.io.pagecache.tracing.DefaultPageCacheTracer 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());
}
}
use of org.neo4j.io.pagecache.tracing.DefaultPageCacheTracer 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());
}
Aggregations