mirror of
https://github.com/isar/libmdbx.git
synced 2025-01-02 00:44:12 +08:00
mdbx: add self_latter_reader_txnid into MDBX_envinfo.
Change-Id: I17ac6e921f99df6ed61096ff0fbfbacf5a7e4608
This commit is contained in:
parent
72557af2b5
commit
260c1d71dd
2
mdbx.h
2
mdbx.h
@ -475,6 +475,8 @@ typedef struct MDBX_envinfo {
|
||||
uint64_t mi_last_pgno; /* ID of the last used page */
|
||||
uint64_t mi_recent_txnid; /* ID of the last committed transaction */
|
||||
uint64_t mi_latter_reader_txnid; /* ID of the last reader transaction */
|
||||
uint64_t mi_self_latter_reader_txnid; /* ID of the last reader transaction of
|
||||
caller process */
|
||||
uint64_t mi_meta0_txnid, mi_meta0_sign;
|
||||
uint64_t mi_meta1_txnid, mi_meta1_sign;
|
||||
uint64_t mi_meta2_txnid, mi_meta2_sign;
|
||||
|
10
src/mdbx.c
10
src/mdbx.c
@ -10161,15 +10161,19 @@ int __cold mdbx_env_info(MDBX_env *env, MDBX_envinfo *arg, size_t bytes) {
|
||||
arg->mi_dxb_pagesize = env->me_psize;
|
||||
arg->mi_sys_pagesize = env->me_os_psize;
|
||||
|
||||
arg->mi_latter_reader_txnid = 0;
|
||||
arg->mi_self_latter_reader_txnid = arg->mi_latter_reader_txnid = 0;
|
||||
if (env->me_lck) {
|
||||
MDBX_reader *r = env->me_lck->mti_readers;
|
||||
arg->mi_latter_reader_txnid = arg->mi_recent_txnid;
|
||||
arg->mi_self_latter_reader_txnid = arg->mi_latter_reader_txnid =
|
||||
arg->mi_recent_txnid;
|
||||
for (unsigned i = 0; i < arg->mi_numreaders; ++i) {
|
||||
if (r[i].mr_pid) {
|
||||
const mdbx_pid_t pid = r[i].mr_pid;
|
||||
if (pid) {
|
||||
const txnid_t txnid = r[i].mr_txnid;
|
||||
if (arg->mi_latter_reader_txnid > txnid)
|
||||
arg->mi_latter_reader_txnid = txnid;
|
||||
if (pid == env->me_pid && arg->mi_self_latter_reader_txnid > txnid)
|
||||
arg->mi_self_latter_reader_txnid = txnid;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user