use of org.neo4j.io.pagecache.context.CursorContext in project neo4j by neo4j.
the class PageCacheByteArray method set3ByteInt.
@Override
public void set3ByteInt(long index, int offset, int value) {
long pageId = pageId(index);
offset += offset(index);
try (CursorContext cursorContext = new CursorContext(pageCacheTracer.createPageCursorTracer(PAGE_CACHE_BYTE_ARRAY_WORKER_TAG));
PageCursor cursor = pagedFile.io(pageId, PF_SHARED_WRITE_LOCK | PF_NO_GROW, cursorContext)) {
cursor.next();
cursor.putShort(offset, (short) value);
cursor.putByte(offset + Short.BYTES, (byte) (value >>> Short.SIZE));
checkBounds(cursor);
} catch (IOException e) {
throw new UncheckedIOException(e);
}
}
use of org.neo4j.io.pagecache.context.CursorContext in project neo4j by neo4j.
the class PageCacheNumberArray method setDefaultValue.
protected void setDefaultValue(long defaultValue) throws IOException {
try (CursorContext cursorContext = new CursorContext(pageCacheTracer.createPageCursorTracer(PAGE_CACHE_WORKER_TAG));
PageCursor writeCursor = pagedFile.io(0, PF_SHARED_WRITE_LOCK | PF_NO_GROW, cursorContext)) {
writeCursor.next();
int pageSize = pagedFile.pageSize();
fillPageWithDefaultValue(writeCursor, defaultValue, pageSize);
if (pageId(length - 1) > 0) {
try (PageCursor cursor = pagedFile.io(1, PF_NO_GROW | PF_SHARED_WRITE_LOCK, cursorContext)) {
while (cursor.next()) {
writeCursor.copyTo(0, cursor, 0, pageSize);
checkBounds(writeCursor);
}
}
}
}
}
use of org.neo4j.io.pagecache.context.CursorContext in project neo4j by neo4j.
the class PageCacheIntArray method set.
@Override
public void set(long index, int value) {
long pageId = pageId(index);
int offset = offset(index);
try (CursorContext cursorContext = new CursorContext(pageCacheTracer.createPageCursorTracer(PAGE_CACHE_INT_ARRAY_WORKER_TAG));
PageCursor cursor = pagedFile.io(pageId, PF_SHARED_WRITE_LOCK | PF_NO_GROW, cursorContext)) {
cursor.next();
cursor.putInt(offset, value);
checkBounds(cursor);
} catch (IOException e) {
throw new UncheckedIOException(e);
}
}
use of org.neo4j.io.pagecache.context.CursorContext in project neo4j by neo4j.
the class PageCacheIntArray method get.
@Override
public int get(long index) {
long pageId = pageId(index);
int offset = offset(index);
try (CursorContext cursorContext = new CursorContext(pageCacheTracer.createPageCursorTracer(PAGE_CACHE_INT_ARRAY_WORKER_TAG));
PageCursor cursor = pagedFile.io(pageId, PF_SHARED_READ_LOCK, cursorContext)) {
cursor.next();
int result;
do {
result = cursor.getInt(offset);
} while (cursor.shouldRetry());
checkBounds(cursor);
return result;
} catch (IOException e) {
throw new UncheckedIOException(e);
}
}
use of org.neo4j.io.pagecache.context.CursorContext in project neo4j by neo4j.
the class LogFilesBuilder method readOnlyLogVersionRepository.
private LogVersionRepository readOnlyLogVersionRepository() throws IOException {
StorageEngineFactory storageEngineFactory = StorageEngineFactory.defaultStorageEngine();
var pageCacheTracer = databaseTracers.getPageCacheTracer();
try (var cursorContext = new CursorContext(pageCacheTracer.createPageCursorTracer(READ_ONLY_LOG_VERSION_READER_TAG))) {
return storageEngineFactory.readOnlyLogVersionRepository(databaseLayout, pageCache, cursorContext);
}
}
Aggregations