mirror of
https://github.com/isar/libmdbx.git
synced 2025-01-30 22:47:16 +08:00
mdbx: add MDBX_opt_rp_augment_limit
.
More for https://github.com/erthink/libmdbx/issues/128 Change-Id: I94f3350b72ad11d0b586aaef1574f7654223bc40
This commit is contained in:
parent
461ba000e3
commit
4cd08f0ef9
4
mdbx.h
4
mdbx.h
@ -1802,6 +1802,10 @@ enum MDBX_option_t {
|
|||||||
|
|
||||||
/** \brief The limit to grow a list of pre-allocated dirty pages. */
|
/** \brief The limit to grow a list of pre-allocated dirty pages. */
|
||||||
MDBX_opt_dp_reserve_limit,
|
MDBX_opt_dp_reserve_limit,
|
||||||
|
|
||||||
|
/** \brief The limit to grow a list of reclaimed pages
|
||||||
|
* for finding a sequence of contiguous pages. */
|
||||||
|
MDBX_opt_rp_augment_limit,
|
||||||
};
|
};
|
||||||
#ifndef __cplusplus
|
#ifndef __cplusplus
|
||||||
/** \ingroup c_settings */
|
/** \ingroup c_settings */
|
||||||
|
14
src/core.c
14
src/core.c
@ -5278,9 +5278,8 @@ skip_cache:
|
|||||||
}
|
}
|
||||||
const unsigned gc_len = MDBX_PNL_SIZE(gc_pnl);
|
const unsigned gc_len = MDBX_PNL_SIZE(gc_pnl);
|
||||||
/* TODO: provide a user-configurable threshold */
|
/* TODO: provide a user-configurable threshold */
|
||||||
const unsigned threshold_2_stop_gc_reclaiming = MDBX_PNL_MAX / 4;
|
|
||||||
if (unlikely(gc_len + MDBX_PNL_SIZE(txn->tw.reclaimed_pglist) >
|
if (unlikely(gc_len + MDBX_PNL_SIZE(txn->tw.reclaimed_pglist) >
|
||||||
threshold_2_stop_gc_reclaiming) &&
|
env->me_options.rp_augment_limit) &&
|
||||||
(pgno_add(txn->mt_next_pgno, num) <= txn->mt_geo.upper ||
|
(pgno_add(txn->mt_next_pgno, num) <= txn->mt_geo.upper ||
|
||||||
gc_len + MDBX_PNL_SIZE(txn->tw.reclaimed_pglist) >=
|
gc_len + MDBX_PNL_SIZE(txn->tw.reclaimed_pglist) >=
|
||||||
MDBX_PNL_MAX / 16 * 15)) {
|
MDBX_PNL_MAX / 16 * 15)) {
|
||||||
@ -9234,6 +9233,7 @@ __cold int mdbx_env_create(MDBX_env **penv) {
|
|||||||
env->me_stuck_meta = -1;
|
env->me_stuck_meta = -1;
|
||||||
|
|
||||||
env->me_options.dp_reserve_limit = 1024;
|
env->me_options.dp_reserve_limit = 1024;
|
||||||
|
env->me_options.rp_augment_limit = 1024 * 1024;
|
||||||
|
|
||||||
int rc;
|
int rc;
|
||||||
const size_t os_psize = mdbx_syspagesize();
|
const size_t os_psize = mdbx_syspagesize();
|
||||||
@ -19710,6 +19710,12 @@ __cold int mdbx_env_set_option(MDBX_env *env, const MDBX_option_t option,
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case MDBX_opt_rp_augment_limit:
|
||||||
|
if (unlikely(value > MDBX_PNL_MAX))
|
||||||
|
return MDBX_EINVAL;
|
||||||
|
env->me_options.rp_augment_limit = (unsigned)value;
|
||||||
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
return MDBX_EINVAL;
|
return MDBX_EINVAL;
|
||||||
}
|
}
|
||||||
@ -19752,6 +19758,10 @@ __cold int mdbx_env_get_option(const MDBX_env *env, const MDBX_option_t option,
|
|||||||
*value = env->me_options.dp_reserve_limit;
|
*value = env->me_options.dp_reserve_limit;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case MDBX_opt_rp_augment_limit:
|
||||||
|
*value = env->me_options.rp_augment_limit;
|
||||||
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
return MDBX_EINVAL;
|
return MDBX_EINVAL;
|
||||||
}
|
}
|
||||||
|
@ -995,6 +995,7 @@ struct MDBX_env {
|
|||||||
unsigned me_dp_reserve_len;
|
unsigned me_dp_reserve_len;
|
||||||
struct {
|
struct {
|
||||||
unsigned dp_reserve_limit;
|
unsigned dp_reserve_limit;
|
||||||
|
unsigned rp_augment_limit;
|
||||||
} me_options;
|
} me_options;
|
||||||
struct {
|
struct {
|
||||||
#if MDBX_LOCKING > 0
|
#if MDBX_LOCKING > 0
|
||||||
|
Loading…
x
Reference in New Issue
Block a user