mdbx: limits the initial size of dpl-list to the current db-size.

Change-Id: I5f575fc6168f50786b6f8a82ae020d323530a12e
This commit is contained in:
Leonid Yuriev 2021-02-11 15:20:37 +03:00
parent 72d978ee48
commit c8dccc9bc4

View File

@ -3293,8 +3293,10 @@ static MDBX_dpl *mdbx_dpl_reserve(MDBX_txn *txn, size_t size) {
static int mdbx_dpl_alloc(MDBX_txn *txn) {
mdbx_tassert(txn,
(txn->mt_flags & MDBX_TXN_RDONLY) == 0 && !txn->tw.dirtylist);
MDBX_dpl *const dl =
mdbx_dpl_reserve(txn, txn->mt_env->me_options.dp_initial);
const size_t len = (txn->mt_env->me_options.dp_initial < txn->mt_geo.upper)
? txn->mt_env->me_options.dp_initial
: txn->mt_geo.upper;
MDBX_dpl *const dl = mdbx_dpl_reserve(txn, len);
if (unlikely(!dl))
return MDBX_ENOMEM;
mdbx_dpl_clear(dl);