mirror of
https://github.com/isar/libmdbx.git
synced 2024-12-30 02:14:12 +08:00
mdbx: fix mdbx_env_set_option()
for dp_initial & dp_limit.
Fixes https://github.com/erthink/libmdbx/issues/179 Change-Id: I925104a45148112e0ce94a069a7468e2b4fc8209
This commit is contained in:
parent
b71206d119
commit
c77494e2aa
20
src/core.c
20
src/core.c
@ -21032,28 +21032,18 @@ __cold int mdbx_env_set_option(MDBX_env *env, const MDBX_option_t option,
|
|||||||
if (env->me_txn)
|
if (env->me_txn)
|
||||||
err = MDBX_EPERM /* unable change during transaction */;
|
err = MDBX_EPERM /* unable change during transaction */;
|
||||||
else {
|
else {
|
||||||
mdbx_dpl_clear(env->me_txn0->tw.dirtylist);
|
const pgno_t value32 = (pgno_t)value;
|
||||||
const unsigned value32 = (unsigned)value;
|
|
||||||
if (option == MDBX_opt_txn_dp_initial &&
|
if (option == MDBX_opt_txn_dp_initial &&
|
||||||
env->me_options.dp_initial != value32) {
|
env->me_options.dp_initial != value32) {
|
||||||
|
env->me_options.dp_initial = value32;
|
||||||
if (env->me_options.dp_limit < value32)
|
if (env->me_options.dp_limit < value32)
|
||||||
env->me_options.dp_limit = value32;
|
env->me_options.dp_limit = value32;
|
||||||
if (env->me_txn0->tw.dirtylist->detent < value32 &&
|
|
||||||
!mdbx_dpl_reserve(env->me_txn0, value32))
|
|
||||||
err = MDBX_ENOMEM;
|
|
||||||
else
|
|
||||||
env->me_options.dp_initial = value32;
|
|
||||||
}
|
}
|
||||||
if (option == MDBX_opt_txn_dp_limit &&
|
if (option == MDBX_opt_txn_dp_limit &&
|
||||||
env->me_options.dp_limit != value32) {
|
env->me_options.dp_limit != value32) {
|
||||||
if (env->me_txn0->tw.dirtylist->detent > value32 &&
|
env->me_options.dp_limit = value32;
|
||||||
!mdbx_dpl_reserve(env->me_txn0, value32))
|
if (env->me_options.dp_initial > value32)
|
||||||
err = MDBX_ENOMEM;
|
env->me_options.dp_initial = value32;
|
||||||
else {
|
|
||||||
if (env->me_options.dp_initial > value32)
|
|
||||||
env->me_options.dp_initial = value32;
|
|
||||||
env->me_options.dp_limit = value32;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user