From b9e4c1ea7381277195495a997fe0abc8c109a0f1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9B=D0=B5=D0=BE=D0=BD=D0=B8=D0=B4=20=D0=AE=D1=80=D1=8C?= =?UTF-8?q?=D0=B5=D0=B2=20=28Leonid=20Yuriev=29?= Date: Sat, 21 Dec 2024 16:49:40 +0300 Subject: [PATCH] =?UTF-8?q?mdbx:=20=D0=B2=D1=8B=D1=87=D0=BB=D0=B5=D0=BD?= =?UTF-8?q?=D0=B5=D0=BD=D0=B8=D0=B5=20`txl=5Fcontain()`.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/gc-get.c | 8 +------- src/txl.c | 8 ++++++++ src/txl.h | 2 ++ 3 files changed, 11 insertions(+), 7 deletions(-) diff --git a/src/gc-get.c b/src/gc-get.c index ff70ba3c..c6d2c62b 100644 --- a/src/gc-get.c +++ b/src/gc-get.c @@ -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); diff --git a/src/txl.c b/src/txl.c index 301cf339..3c64e085 100644 --- a/src/txl.c +++ b/src/txl.c @@ -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; +} diff --git a/src/txl.h b/src/txl.h index e80db522..d8d67e05 100644 --- a/src/txl.h +++ b/src/txl.h @@ -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);