mirror of
https://github.com/isar/libmdbx.git
synced 2025-01-06 18:34:13 +08:00
mdbx: refine update_gc() for small pages with huge transactions.
Change-Id: I66080e11a780a6a711691918179bc21d9a121347
This commit is contained in:
parent
d3e609d7ff
commit
78e592579a
14
src/core.c
14
src/core.c
@ -6917,13 +6917,15 @@ static int mdbx_update_gc(MDBX_txn *txn) {
|
|||||||
txn->mt_cursors[FREE_DBI] = &couple.outer;
|
txn->mt_cursors[FREE_DBI] = &couple.outer;
|
||||||
|
|
||||||
retry:
|
retry:
|
||||||
|
++loop;
|
||||||
|
retry_noaccount:
|
||||||
mdbx_trace("%s", " >> restart");
|
mdbx_trace("%s", " >> restart");
|
||||||
mdbx_tassert(
|
mdbx_tassert(
|
||||||
txn, mdbx_pnl_check4assert(txn->tw.reclaimed_pglist, txn->mt_next_pgno));
|
txn, mdbx_pnl_check4assert(txn->tw.reclaimed_pglist, txn->mt_next_pgno));
|
||||||
mdbx_tassert(txn, mdbx_dirtylist_check(txn));
|
mdbx_tassert(txn, mdbx_dirtylist_check(txn));
|
||||||
mdbx_tassert(txn, txn->tw.dirtyroom + txn->tw.dirtylist->length ==
|
mdbx_tassert(txn, txn->tw.dirtyroom + txn->tw.dirtylist->length ==
|
||||||
MDBX_DPL_TXNFULL);
|
MDBX_DPL_TXNFULL);
|
||||||
if (unlikely(/* paranoia */ ++loop > 42)) {
|
if (unlikely(/* paranoia */ loop > ((MDBX_DEBUG > 0) ? 9 : 99))) {
|
||||||
mdbx_error("too more loops %u, bailout", loop);
|
mdbx_error("too more loops %u, bailout", loop);
|
||||||
rc = MDBX_PROBLEM;
|
rc = MDBX_PROBLEM;
|
||||||
goto bailout;
|
goto bailout;
|
||||||
@ -7144,7 +7146,9 @@ retry:
|
|||||||
if (unlikely(amount != MDBX_PNL_SIZE(txn->tw.reclaimed_pglist))) {
|
if (unlikely(amount != MDBX_PNL_SIZE(txn->tw.reclaimed_pglist))) {
|
||||||
mdbx_trace("%s.reclaimed-list changed %u -> %u, retry", dbg_prefix_mode,
|
mdbx_trace("%s.reclaimed-list changed %u -> %u, retry", dbg_prefix_mode,
|
||||||
amount, (unsigned)MDBX_PNL_SIZE(txn->tw.reclaimed_pglist));
|
amount, (unsigned)MDBX_PNL_SIZE(txn->tw.reclaimed_pglist));
|
||||||
goto retry /* rare case, but avoids GC fragmentation and one loop. */;
|
goto retry_noaccount /* rare case, but avoids GC fragmentation and one
|
||||||
|
cycle. */
|
||||||
|
;
|
||||||
}
|
}
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -7389,7 +7393,7 @@ retry:
|
|||||||
unlikely(amount < MDBX_PNL_SIZE(txn->tw.reclaimed_pglist))) {
|
unlikely(amount < MDBX_PNL_SIZE(txn->tw.reclaimed_pglist))) {
|
||||||
mdbx_notice("** restart: reclaimed-list growth %u -> %u", amount,
|
mdbx_notice("** restart: reclaimed-list growth %u -> %u", amount,
|
||||||
(unsigned)MDBX_PNL_SIZE(txn->tw.reclaimed_pglist));
|
(unsigned)MDBX_PNL_SIZE(txn->tw.reclaimed_pglist));
|
||||||
goto retry;
|
goto retry_noaccount;
|
||||||
}
|
}
|
||||||
|
|
||||||
continue;
|
continue;
|
||||||
@ -7490,8 +7494,8 @@ retry:
|
|||||||
|
|
||||||
if (unlikely(txn->tw.loose_count ||
|
if (unlikely(txn->tw.loose_count ||
|
||||||
amount != MDBX_PNL_SIZE(txn->tw.reclaimed_pglist))) {
|
amount != MDBX_PNL_SIZE(txn->tw.reclaimed_pglist))) {
|
||||||
mdbx_notice("** restart: reclaimed-list changed (%u -> %u, %u)", amount,
|
mdbx_notice("** restart: reclaimed-list growth (%u -> %u, loose +%u)",
|
||||||
MDBX_PNL_SIZE(txn->tw.reclaimed_pglist),
|
amount, MDBX_PNL_SIZE(txn->tw.reclaimed_pglist),
|
||||||
txn->tw.loose_count);
|
txn->tw.loose_count);
|
||||||
goto retry;
|
goto retry;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user