mdbx: minor refine mdbx_page_get().

Change-Id: Ie0ca17883ed88e4d9addf8b90061d25a80d77022
This commit is contained in:
Leonid Yuriev 2020-12-09 03:49:23 +03:00
parent a906569c58
commit 44089b03df

View File

@ -11427,9 +11427,10 @@ __hot static int mdbx_page_get(MDBX_cursor *mc, pgno_t pgno, MDBX_page **ret,
MDBX_page *p = nullptr;
mdbx_assert(env, ((txn->mt_flags ^ env->me_flags) & MDBX_WRITEMAP) == 0);
mdbx_assert(env, pp_txnid >= MIN_TXNID && pp_txnid <= txn->mt_txnid);
const uint16_t illegal_bits = (txn->mt_flags & MDBX_TXN_RDONLY)
? P_LOOSE | P_SUBP | P_META | P_DIRTY
: P_LOOSE | P_SUBP | P_META;
const uint16_t illegal_bits =
(txn->mt_flags & MDBX_TXN_RDONLY)
? ~(P_BRANCH | P_LEAF | P_LEAF2 | P_OVERFLOW)
: ~(P_BRANCH | P_LEAF | P_LEAF2 | P_OVERFLOW | P_DIRTY);
int level;
if (unlikely((txn->mt_flags & (MDBX_TXN_RDONLY | MDBX_WRITEMAP)) == 0)) {
level = 1;
@ -11438,7 +11439,7 @@ __hot static int mdbx_page_get(MDBX_cursor *mc, pgno_t pgno, MDBX_page **ret,
* because the dirty list got full. Bring this page
* back in from the map (but don't unspill it here,
* leave that unless page_touch happens again). */
if (txn->tw.spill_pages &&
if (unlikely(txn->mt_flags & MDBX_TXN_SPILLS) && txn->tw.spill_pages &&
mdbx_pnl_exist(txn->tw.spill_pages, pgno << 1)) {
pp_txnid = txn->mt_txnid;
goto spilled;