mirror of
https://github.com/isar/libmdbx.git
synced 2025-01-06 18:04:12 +08:00
mdbx: major fix - madvise(MADV_REMOVE) only for exclusive mode.
Change-Id: I6799df7b85eaf32a1c46f251ca64a4df4ff092b2
This commit is contained in:
parent
a3ee20e4f6
commit
0b07749fba
@ -4205,9 +4205,10 @@ static int __cold mdbx_env_map(MDBX_env *env, size_t usedsize) {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef MADV_REMOVE
|
#ifdef MADV_REMOVE
|
||||||
if (env->me_flags & MDBX_WRITEMAP)
|
if (usedsize && (env->me_flags & MDBX_WRITEMAP)) {
|
||||||
(void)madvise(env->me_map + usedsize, env->me_mapsize - usedsize,
|
(void)madvise(env->me_map + usedsize, env->me_mapsize - usedsize,
|
||||||
MADV_REMOVE);
|
MADV_REMOVE);
|
||||||
|
}
|
||||||
#else
|
#else
|
||||||
(void)usedsize;
|
(void)usedsize;
|
||||||
#endif
|
#endif
|
||||||
@ -4619,8 +4620,10 @@ static int __cold mdbx_setup_dxb(MDBX_env *env, int lck_rc) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
err = mdbx_env_map(env, expected_bytes);
|
err = mdbx_env_map(env, (lck_rc != /* lck exclusive */ MDBX_RESULT_TRUE)
|
||||||
if (err)
|
? 0
|
||||||
|
: expected_bytes);
|
||||||
|
if (err != MDBX_SUCCESS)
|
||||||
return err;
|
return err;
|
||||||
|
|
||||||
const unsigned meta_clash_mask = mdbx_meta_eq_mask(env);
|
const unsigned meta_clash_mask = mdbx_meta_eq_mask(env);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user