mirror of
https://github.com/isar/libmdbx.git
synced 2025-01-06 17:24:12 +08:00
mdbx: relax backlog estimation/preparation for freelist_save().
Change-Id: I931b76179855c16cb8b6265db262309061ac196d
This commit is contained in:
parent
aa5403ad38
commit
684847db39
@ -2928,7 +2928,7 @@ static __inline int mdbx_backlog_size(MDBX_txn *txn) {
|
|||||||
int reclaimed = txn->mt_env->me_reclaimed_pglist
|
int reclaimed = txn->mt_env->me_reclaimed_pglist
|
||||||
? txn->mt_env->me_reclaimed_pglist[0]
|
? txn->mt_env->me_reclaimed_pglist[0]
|
||||||
: 0;
|
: 0;
|
||||||
return reclaimed + txn->mt_loose_count;
|
return reclaimed + txn->mt_loose_count + txn->mt_end_pgno - txn->mt_next_pgno;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* LY: Prepare a backlog of pages to modify FreeDB itself,
|
/* LY: Prepare a backlog of pages to modify FreeDB itself,
|
||||||
@ -2943,7 +2943,8 @@ static int mdbx_prep_backlog(MDBX_txn *txn, MDBX_cursor *mc) {
|
|||||||
if (unlikely(rc))
|
if (unlikely(rc))
|
||||||
return rc;
|
return rc;
|
||||||
|
|
||||||
while (unlikely(mdbx_backlog_size(txn) < extra)) {
|
int backlog;
|
||||||
|
while (unlikely((backlog = mdbx_backlog_size(txn)) < extra)) {
|
||||||
rc = mdbx_page_alloc(mc, 1, NULL, MDBX_ALLOC_GC);
|
rc = mdbx_page_alloc(mc, 1, NULL, MDBX_ALLOC_GC);
|
||||||
if (unlikely(rc)) {
|
if (unlikely(rc)) {
|
||||||
if (unlikely(rc != MDBX_NOTFOUND))
|
if (unlikely(rc != MDBX_NOTFOUND))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user