mdbx: fix/refine handling options.rp_augment_limit detent while loading GC records.

This commit is contained in:
Leonid Yuriev 2022-01-05 11:03:21 +03:00
parent ab83d173ac
commit 024900ee9c

View File

@ -6493,18 +6493,15 @@ no_loose:
goto fail; goto fail;
} }
const unsigned gc_len = MDBX_PNL_SIZE(gc_pnl); const unsigned gc_len = MDBX_PNL_SIZE(gc_pnl);
if (unlikely(/* resulting list is tool long */ gc_len + if (unlikely(/* list is too long already */ MDBX_PNL_SIZE(
MDBX_PNL_SIZE(txn->tw.reclaimed_pglist) > txn->tw.reclaimed_pglist) >=
env->me_options.rp_augment_limit) && env->me_options.rp_augment_limit) &&
(((/* not a slot-request from gc-update */ ((/* not a slot-request from gc-update */
(flags & MDBX_ALLOC_SLOT) == 0 || (flags & MDBX_ALLOC_SLOT) == 0 &&
(flags & MDBX_LIFORECLAIM) == 0 || /* have enough unallocated space */ txn->mt_geo.upper >=
(txn->tw.lifo_reclaimed && pgno_add(txn->mt_next_pgno, num)) ||
MDBX_PNL_SIZE(txn->tw.lifo_reclaimed))) &&
/* have enough unallocated space */ 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_PGL_LIMIT / 16 * 15)) { MDBX_PGL_LIMIT)) {
/* Stop reclaiming to avoid overflow the page list. /* Stop reclaiming to avoid overflow the page list.
* This is a rare case while search for a continuously multi-page region * This is a rare case while search for a continuously multi-page region
* in a large database. https://github.com/erthink/libmdbx/issues/123 */ * in a large database. https://github.com/erthink/libmdbx/issues/123 */