mirror of
https://github.com/isar/libmdbx.git
synced 2025-01-30 16:42:06 +08:00
mdbx: add MDBX_DBG_DONT_UPGRADE
flag.
This commit is contained in:
parent
a5c064c33e
commit
de63041b7d
11
mdbx.h
11
mdbx.h
@ -864,18 +864,23 @@ enum MDBX_debug_flags_t {
|
||||
MDBX_DBG_JITTER = 4,
|
||||
|
||||
/** Include or not meta-pages in coredump files.
|
||||
* May affect performance in \ref MDBX_WRITEMAP mode */
|
||||
* \note May affect performance in \ref MDBX_WRITEMAP mode */
|
||||
MDBX_DBG_DUMP = 8,
|
||||
|
||||
/** Allow multi-opening environment(s) */
|
||||
MDBX_DBG_LEGACY_MULTIOPEN = 16,
|
||||
|
||||
/** Allow read and write transactions overlapping for the same thread */
|
||||
/** Allow read and write transactions overlapping for the same thread. */
|
||||
MDBX_DBG_LEGACY_OVERLAP = 32,
|
||||
|
||||
/** Don't auto-upgrade format signature.
|
||||
* \note However a new write transactions will use and store
|
||||
* the last signature regardless this flag */
|
||||
MDBX_DBG_DONT_UPGRADE = 64,
|
||||
|
||||
#ifdef ENABLE_UBSAN
|
||||
MDBX_DBG_MAX = ((unsigned)MDBX_LOG_MAX) << 16 |
|
||||
63 /* avoid UBSAN false-positive trap by a tests */,
|
||||
127 /* avoid UBSAN false-positive trap by a tests */,
|
||||
#endif /* ENABLE_UBSAN */
|
||||
|
||||
/** for mdbx_setup_debug() only: Don't change current settings */
|
||||
|
@ -12278,7 +12278,8 @@ __cold static int mdbx_setup_dxb(MDBX_env *env, const int lck_rc,
|
||||
atomic_store32(&env->me_lck->mti_discarded_tail,
|
||||
bytes2pgno(env, used_aligned2os_bytes), mo_Relaxed);
|
||||
|
||||
if ((env->me_flags & MDBX_RDONLY) == 0 && env->me_stuck_meta < 0) {
|
||||
if ((env->me_flags & MDBX_RDONLY) == 0 && env->me_stuck_meta < 0 &&
|
||||
(mdbx_runtime_flags & MDBX_DBG_DONT_UPGRADE) == 0) {
|
||||
for (int n = 0; n < NUM_METAS; ++n) {
|
||||
MDBX_meta *const pmeta = METAPAGE(env, n);
|
||||
if (unlikely(unaligned_peek_u64(4, &pmeta->mm_magic_and_version) !=
|
||||
@ -12618,7 +12619,8 @@ __cold static int __must_check_result mdbx_override_meta(
|
||||
mdbx_assert(env, meta_checktxnid(env, model, true));
|
||||
if (shape) {
|
||||
mdbx_assert(env, meta_checktxnid(env, shape, true));
|
||||
if (env->me_stuck_meta >= 0)
|
||||
if (env->me_stuck_meta >= 0 ||
|
||||
(mdbx_runtime_flags & MDBX_DBG_DONT_UPGRADE) != 0)
|
||||
memcpy(&model->mm_magic_and_version, &shape->mm_magic_and_version,
|
||||
sizeof(model->mm_magic_and_version));
|
||||
model->mm_extra_flags = shape->mm_extra_flags;
|
||||
@ -20877,7 +20879,8 @@ __cold int mdbx_setup_debug(int loglevel, int flags, MDBX_debug_func *logger) {
|
||||
#if MDBX_DEBUG
|
||||
MDBX_DBG_ASSERT | MDBX_DBG_AUDIT | MDBX_DBG_JITTER |
|
||||
#endif
|
||||
MDBX_DBG_DUMP | MDBX_DBG_LEGACY_MULTIOPEN | MDBX_DBG_LEGACY_OVERLAP;
|
||||
MDBX_DBG_DUMP | MDBX_DBG_LEGACY_MULTIOPEN | MDBX_DBG_LEGACY_OVERLAP |
|
||||
MDBX_DBG_DONT_UPGRADE;
|
||||
mdbx_runtime_flags = (uint8_t)flags;
|
||||
}
|
||||
|
||||
|
@ -1226,7 +1226,7 @@ int main(int argc, char *argv[]) {
|
||||
mdbx_setup_debug((verbose < MDBX_LOG_TRACE - 1)
|
||||
? (MDBX_log_level_t)(verbose + 1)
|
||||
: MDBX_LOG_TRACE,
|
||||
MDBX_DBG_LEGACY_OVERLAP, logger);
|
||||
MDBX_DBG_LEGACY_OVERLAP | MDBX_DBG_DONT_UPGRADE, logger);
|
||||
|
||||
rc = mdbx_env_create(&env);
|
||||
if (rc) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user