use of org.neo4j.io.pagecache.tracing.DefaultPageCacheTracer in project neo4j by neo4j.
the class IdContextFactoryBuilderTest method useProvidedPageCacheCursorOnIdMaintenance.
@Test
void useProvidedPageCacheCursorOnIdMaintenance() throws IOException {
PageCacheTracer cacheTracer = new DefaultPageCacheTracer();
Config config = defaults();
var idContextFactory = IdContextFactoryBuilder.of(fs, jobScheduler, config, cacheTracer).build();
var idContext = idContextFactory.createIdContext(from("test", UUID.randomUUID()));
var idGeneratorFactory = idContext.getIdGeneratorFactory();
var idController = idContext.getIdController();
idController.initialize(() -> () -> true);
Path file = testDirectory.file("b");
IdType idType = IdType.NODE;
try (IdGenerator idGenerator = idGeneratorFactory.create(pageCache, file, idType, 1, false, 100, writable(), config, NULL, immutable.empty())) {
idGenerator.marker(NULL).markDeleted(1);
idGeneratorFactory.clearCache(NULL);
assertThat(cacheTracer.pins()).isZero();
assertThat(cacheTracer.unpins()).isZero();
assertThat(cacheTracer.hits()).isZero();
idController.maintenance();
assertThat(cacheTracer.pins()).isGreaterThan(0);
assertThat(cacheTracer.unpins()).isGreaterThan(0);
assertThat(cacheTracer.hits()).isGreaterThan(0);
}
}
use of org.neo4j.io.pagecache.tracing.DefaultPageCacheTracer in project neo4j by neo4j.
the class SimpleIndexAccessorCompatibility method tracePageCacheAccessOnConsistencyCheck.
@Test
public void tracePageCacheAccessOnConsistencyCheck() {
var pageCacheTracer = new DefaultPageCacheTracer();
try (var cursorContext = new CursorContext(pageCacheTracer.createPageCursorTracer("tracePageCacheAccessOnConsistencyCheck"))) {
accessor.consistencyCheck(ReporterFactories.noopReporterFactory(), cursorContext);
PageCursorTracer cursorTracer = cursorContext.getCursorTracer();
assertThat(cursorTracer.pins()).isEqualTo(2);
assertThat(cursorTracer.unpins()).isEqualTo(2);
assertThat(cursorTracer.faults()).isEqualTo(2);
}
}
use of org.neo4j.io.pagecache.tracing.DefaultPageCacheTracer in project neo4j by neo4j.
the class PropertyStoreTraceIT method tracePageCacheAccessOnPropertyBlockIdGeneration.
@Test
void tracePageCacheAccessOnPropertyBlockIdGeneration() {
var propertyStore = storageEngine.testAccessNeoStores().getPropertyStore();
prepareIdGenerator(propertyStore.getStringStore().getIdGenerator());
var pageCacheTracer = new DefaultPageCacheTracer();
try (var cursorContext = new CursorContext(pageCacheTracer.createPageCursorTracer("tracePageCacheAccessOnPropertyBlockIdGeneration"))) {
var propertyBlock = new PropertyBlock();
var dynamicRecord = new DynamicRecord(2);
dynamicRecord.setData(new byte[] { 0, 1, 2, 3, 4, 5, 6, 7 });
propertyBlock.addValueRecord(dynamicRecord);
propertyStore.encodeValue(propertyBlock, 1, stringValue(randomAlphabetic((int) kibiBytes(4))), cursorContext, INSTANCE);
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 CommitProcessTracingIT method tracePageCacheAccessOnTransactionApply.
@Test
void tracePageCacheAccessOnTransactionApply() throws TransactionFailureException {
var transaction = new PhysicalTransactionRepresentation(List.of(new Command.NodeCountsCommand(1, 2)), EMPTY_BYTE_ARRAY, 0, 0, 0, 0, ANONYMOUS);
var pageCacheTracer = new DefaultPageCacheTracer();
try (var cursorContext = new CursorContext(pageCacheTracer.createPageCursorTracer("tracePageCacheAccessOnTransactionApply"))) {
assertZeroCursor(cursorContext);
commitProcess.commit(new TransactionToApply(transaction, cursorContext), NULL, EXTERNAL);
assertCursor(cursorContext, 3);
}
}
use of org.neo4j.io.pagecache.tracing.DefaultPageCacheTracer in project neo4j by neo4j.
the class IndexIteratorIT method setUp.
@BeforeEach
void setUp() throws IOException {
var label = label("any");
var propertyName = "property";
try (var tx = database.beginTx()) {
var node = tx.createNode(label);
node.setProperty(propertyName, "nodeValue");
tx.commit();
}
try (var tx = database.beginTx()) {
tx.schema().indexFor(label).on(propertyName).withName(INDEX_NAME).create();
tx.commit();
}
try (var transaction = database.beginTx()) {
transaction.schema().awaitIndexesOnline(10, MINUTES);
}
var neoStores = storageEngine.testAccessNeoStores();
indexAccessors = new IndexAccessors(providerMap, neoStores, new IndexSamplingConfig(config), PageCacheTracer.NULL, SIMPLE_NAME_LOOKUP, () -> KernelVersion.LATEST);
pageCacheTracer = new DefaultPageCacheTracer();
}
Aggregations