mdbx: вычленение txl_contain().

This commit is contained in:
Леонид Юрьев (Leonid Yuriev) 2024-12-21 16:49:40 +03:00
parent bc56a613ab
commit b9e4c1ea73
3 changed files with 11 additions and 7 deletions

View File

@ -590,13 +590,7 @@ static inline bool is_gc_usable(MDBX_txn *txn, const MDBX_cursor *mc, const uint
return true;
}
__hot static bool is_already_reclaimed(const MDBX_txn *txn, txnid_t id) {
const size_t len = MDBX_PNL_GETSIZE(txn->tw.gc.retxl);
for (size_t i = 1; i <= len; ++i)
if (txn->tw.gc.retxl[i] == id)
return true;
return false;
}
static inline bool is_already_reclaimed(const MDBX_txn *txn, txnid_t id) { return txl_contain(txn->tw.gc.retxl, id); }
__hot static pgno_t repnl_get_single(MDBX_txn *txn) {
const size_t len = MDBX_PNL_GETSIZE(txn->tw.repnl);

View File

@ -89,3 +89,11 @@ int __must_check_result txl_append(txl_t __restrict *ptxl, txnid_t id) {
txl_xappend(*ptxl, id);
return MDBX_SUCCESS;
}
__hot bool txl_contain(const txl_t txl, txnid_t id) {
const size_t len = MDBX_PNL_GETSIZE(txl);
for (size_t i = 1; i <= len; ++i)
if (txl[i] == id)
return true;
return false;
}

View File

@ -22,3 +22,5 @@ MDBX_INTERNAL void txl_free(txl_t txl);
MDBX_INTERNAL int __must_check_result txl_append(txl_t __restrict *ptxl, txnid_t id);
MDBX_INTERNAL void txl_sort(txl_t txl);
MDBX_INTERNAL bool txl_contain(const txl_t txl, txnid_t id);