mirror of
https://github.com/isar/libmdbx.git
synced 2025-01-06 19:04:12 +08:00
mdbx: skip update meta-geo in read-only mode.
Change-Id: I1c9610920ad87dc8110e8d03038ef385220000c8
This commit is contained in:
parent
426d207fc4
commit
538d2e4d62
21
src/core.c
21
src/core.c
@ -9709,8 +9709,7 @@ static int __cold mdbx_setup_dxb(MDBX_env *env, const int lck_rc) {
|
|||||||
env->me_dxb_mmap.current);
|
env->me_dxb_mmap.current);
|
||||||
return MDBX_PROBLEM;
|
return MDBX_PROBLEM;
|
||||||
}
|
}
|
||||||
if (env->me_dxb_mmap.current != env->me_dbgeo.now &&
|
if (env->me_dxb_mmap.current != env->me_dbgeo.now) {
|
||||||
(env->me_flags & MDBX_RDONLY) == 0) {
|
|
||||||
meta.mm_geo.now = bytes2pgno(env, env->me_dxb_mmap.current);
|
meta.mm_geo.now = bytes2pgno(env, env->me_dxb_mmap.current);
|
||||||
mdbx_verbose("update meta-geo to filesize %" PRIuPTR " bytes, %" PRIaPGNO
|
mdbx_verbose("update meta-geo to filesize %" PRIuPTR " bytes, %" PRIaPGNO
|
||||||
" pages",
|
" pages",
|
||||||
@ -9718,9 +9717,19 @@ static int __cold mdbx_setup_dxb(MDBX_env *env, const int lck_rc) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (memcmp(&meta.mm_geo, &head->mm_geo, sizeof(meta.mm_geo))) {
|
if (memcmp(&meta.mm_geo, &head->mm_geo, sizeof(meta.mm_geo))) {
|
||||||
|
if (env->me_flags & MDBX_RDONLY) {
|
||||||
|
mdbx_warning(
|
||||||
|
"skipped update meta.geo in read-only mode: from l%" PRIaPGNO
|
||||||
|
"-n%" PRIaPGNO "-u%" PRIaPGNO "/s%u-g%u, to l%" PRIaPGNO
|
||||||
|
"-n%" PRIaPGNO "-u%" PRIaPGNO "/s%u-g%u",
|
||||||
|
head->mm_geo.lower, head->mm_geo.now, head->mm_geo.upper,
|
||||||
|
head->mm_geo.shrink, head->mm_geo.grow, meta.mm_geo.lower,
|
||||||
|
meta.mm_geo.now, meta.mm_geo.upper, meta.mm_geo.shrink,
|
||||||
|
meta.mm_geo.grow);
|
||||||
|
} else {
|
||||||
const txnid_t txnid = mdbx_meta_txnid_stable(env, head);
|
const txnid_t txnid = mdbx_meta_txnid_stable(env, head);
|
||||||
const txnid_t next_txnid = safe64_txnid_next(txnid);
|
const txnid_t next_txnid = safe64_txnid_next(txnid);
|
||||||
mdbx_verbose("updating meta.geo: "
|
mdbx_notice("updating meta.geo: "
|
||||||
"from l%" PRIaPGNO "-n%" PRIaPGNO "-u%" PRIaPGNO
|
"from l%" PRIaPGNO "-n%" PRIaPGNO "-u%" PRIaPGNO
|
||||||
"/s%u-g%u (txn#%" PRIaTXN "), "
|
"/s%u-g%u (txn#%" PRIaTXN "), "
|
||||||
"to l%" PRIaPGNO "-n%" PRIaPGNO "-u%" PRIaPGNO
|
"to l%" PRIaPGNO "-n%" PRIaPGNO "-u%" PRIaPGNO
|
||||||
@ -9741,12 +9750,14 @@ static int __cold mdbx_setup_dxb(MDBX_env *env, const int lck_rc) {
|
|||||||
"/s%u-g%u (txn#%" PRIaTXN ")",
|
"/s%u-g%u (txn#%" PRIaTXN ")",
|
||||||
err, head->mm_geo.lower, head->mm_geo.now,
|
err, head->mm_geo.lower, head->mm_geo.now,
|
||||||
head->mm_geo.upper, head->mm_geo.shrink, head->mm_geo.grow,
|
head->mm_geo.upper, head->mm_geo.shrink, head->mm_geo.grow,
|
||||||
txnid, meta.mm_geo.lower, meta.mm_geo.now, meta.mm_geo.upper,
|
txnid, meta.mm_geo.lower, meta.mm_geo.now,
|
||||||
meta.mm_geo.shrink, meta.mm_geo.grow, next_txnid);
|
meta.mm_geo.upper, meta.mm_geo.shrink, meta.mm_geo.grow,
|
||||||
|
next_txnid);
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
*env->me_discarded_tail = bytes2pgno(env, used_aligned2os_bytes);
|
*env->me_discarded_tail = bytes2pgno(env, used_aligned2os_bytes);
|
||||||
if (used_aligned2os_bytes < env->me_dxb_mmap.current) {
|
if (used_aligned2os_bytes < env->me_dxb_mmap.current) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user