mirror of
https://github.com/isar/libmdbx.git
synced 2025-01-06 19:14:14 +08:00
mdbx: size_t for sync_threshold and mapsize.
This commit is contained in:
parent
802c10f13f
commit
61d7ea283f
@ -666,9 +666,9 @@ struct MDBX_env {
|
|||||||
#if MDBX_DEBUG
|
#if MDBX_DEBUG
|
||||||
MDBX_assert_func *me_assert_func; /* Callback for assertion failures */
|
MDBX_assert_func *me_assert_func; /* Callback for assertion failures */
|
||||||
#endif
|
#endif
|
||||||
uint64_t me_sync_pending; /* Total dirty/non-sync'ed bytes
|
size_t me_sync_pending; /* Total dirty/non-sync'ed bytes
|
||||||
* since the last mdbx_env_sync() */
|
* since the last mdbx_env_sync() */
|
||||||
uint64_t me_sync_threshold; /* Treshold of above to force synchronous flush */
|
size_t me_sync_threshold; /* Treshold of above to force synchronous flush */
|
||||||
MDBX_oom_func *me_oom_func; /* Callback for kicking laggard readers */
|
MDBX_oom_func *me_oom_func; /* Callback for kicking laggard readers */
|
||||||
#ifdef USE_VALGRIND
|
#ifdef USE_VALGRIND
|
||||||
int me_valgrind_handle;
|
int me_valgrind_handle;
|
||||||
|
10
src/mdbx.c
10
src/mdbx.c
@ -2099,8 +2099,8 @@ int mdbx_env_sync(MDBX_env *env, int force) {
|
|||||||
|
|
||||||
if (!META_IS_STEADY(head) || env->me_sync_pending ||
|
if (!META_IS_STEADY(head) || env->me_sync_pending ||
|
||||||
env->me_mapsize != head->mm_mapsize) {
|
env->me_mapsize != head->mm_mapsize) {
|
||||||
mdbx_debug("meta-head %" PRIaPGNO ", %s, sync_pending %" PRIu64
|
mdbx_debug("meta-head %" PRIaPGNO ", %s, sync_pending %" PRIuPTR
|
||||||
", mapsize env=%" PRIuPTR " meta=%" PRIuPTR,
|
", mapsize env=%" PRIuPTR " meta=%" PRIu64,
|
||||||
container_of(head, MDBX_page, mp_data)->mp_pgno,
|
container_of(head, MDBX_page, mp_data)->mp_pgno,
|
||||||
mdbx_durable_str(head), env->me_sync_pending, env->me_mapsize,
|
mdbx_durable_str(head), env->me_sync_pending, env->me_mapsize,
|
||||||
head->mm_mapsize);
|
head->mm_mapsize);
|
||||||
@ -4116,7 +4116,7 @@ static int __cold mdbx_setup_dxb(MDBX_env *env, int lck_rc) {
|
|||||||
if (unlikely(err != MDBX_SUCCESS))
|
if (unlikely(err != MDBX_SUCCESS))
|
||||||
return err;
|
return err;
|
||||||
if (size != env->me_mapsize) {
|
if (size != env->me_mapsize) {
|
||||||
mdbx_notice("filesize mismatch (wanna %" PRIu64 ", have %" PRIu64 ")",
|
mdbx_notice("filesize mismatch (wanna %" PRIuPTR ", have %" PRIu64 ")",
|
||||||
env->me_mapsize, size);
|
env->me_mapsize, size);
|
||||||
if ((env->me_flags & MDBX_RDONLY) ||
|
if ((env->me_flags & MDBX_RDONLY) ||
|
||||||
lck_rc != /* lck exclusive */ MDBX_RESULT_TRUE) {
|
lck_rc != /* lck exclusive */ MDBX_RESULT_TRUE) {
|
||||||
@ -4176,13 +4176,13 @@ static int __cold mdbx_setup_dxb(MDBX_env *env, int lck_rc) {
|
|||||||
|
|
||||||
head = mdbx_meta_head(env);
|
head = mdbx_meta_head(env);
|
||||||
if (head->mm_mapsize != env->me_mapsize) {
|
if (head->mm_mapsize != env->me_mapsize) {
|
||||||
mdbx_info("mismatch meta.mapsize: present %" PRIu64 ", should %" PRIu64,
|
mdbx_info("mismatch meta.mapsize: present %" PRIu64 ", should %" PRIuPTR,
|
||||||
head->mm_mapsize, env->me_mapsize);
|
head->mm_mapsize, env->me_mapsize);
|
||||||
if ((env->me_flags & MDBX_RDONLY) ||
|
if ((env->me_flags & MDBX_RDONLY) ||
|
||||||
lck_rc != /* lck exclusive */ MDBX_RESULT_TRUE)
|
lck_rc != /* lck exclusive */ MDBX_RESULT_TRUE)
|
||||||
return MDBX_MAP_RESIZED;
|
return MDBX_MAP_RESIZED;
|
||||||
|
|
||||||
mdbx_trace("updating meta.mapsize: from %" PRIu64 " to %" PRIu64,
|
mdbx_trace("updating meta.mapsize: from %" PRIu64 " to %" PRIuPTR,
|
||||||
head->mm_mapsize, env->me_mapsize);
|
head->mm_mapsize, env->me_mapsize);
|
||||||
meta = *head;
|
meta = *head;
|
||||||
meta.mm_mapsize = env->me_mapsize;
|
meta.mm_mapsize = env->me_mapsize;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user