From c77494e2aa9ae7b25f525eaf4d6e2f2fdd2554a3 Mon Sep 17 00:00:00 2001 From: Leonid Yuriev Date: Wed, 24 Mar 2021 19:16:52 +0300 Subject: [PATCH] mdbx: fix `mdbx_env_set_option()` for dp_initial & dp_limit. Fixes https://github.com/erthink/libmdbx/issues/179 Change-Id: I925104a45148112e0ce94a069a7468e2b4fc8209 --- src/core.c | 20 +++++--------------- 1 file changed, 5 insertions(+), 15 deletions(-) diff --git a/src/core.c b/src/core.c index 980b4a5d..fa8b903f 100644 --- a/src/core.c +++ b/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) err = MDBX_EPERM /* unable change during transaction */; else { - mdbx_dpl_clear(env->me_txn0->tw.dirtylist); - const unsigned value32 = (unsigned)value; + const pgno_t value32 = (pgno_t)value; if (option == MDBX_opt_txn_dp_initial && env->me_options.dp_initial != value32) { + env->me_options.dp_initial = value32; if (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 && 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 { - if (env->me_options.dp_initial > value32) - env->me_options.dp_initial = value32; - env->me_options.dp_limit = value32; - } + env->me_options.dp_limit = value32; + if (env->me_options.dp_initial > value32) + env->me_options.dp_initial = value32; } } break;