From 61d21b0a02c10328fd274d7905da2636c126810d 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: Tue, 27 Dec 2022 15:03:54 +0300 Subject: [PATCH] =?UTF-8?q?mdbx:=20=D0=BD=D0=B5=20=D1=82=D1=80=D0=BE=D0=B3?= =?UTF-8?q?=D0=B0=D1=82=D1=8C=20LRU=20=D0=B8=20dbi=20=D0=B2=20cursor=5Ftou?= =?UTF-8?q?ch()=20=D0=B4=D0=BB=D1=8F=20=D0=B2=D0=BB=D0=BE=D0=B6=D0=B5?= =?UTF-8?q?=D0=BD=D0=BD=D1=8B=D1=85=20=D0=BA=D1=83=D1=80=D1=81=D0=BE=D1=80?= =?UTF-8?q?=D0=BE=D0=B2.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/core.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/src/core.c b/src/core.c index 976a2251..091daa05 100644 --- a/src/core.c +++ b/src/core.c @@ -16909,22 +16909,22 @@ static int touch_dbi(MDBX_cursor *mc) { return MDBX_SUCCESS; } -static int cursor_touch(MDBX_cursor *const mc, const MDBX_val *key, - const MDBX_val *data) { +static __hot int cursor_touch(MDBX_cursor *const mc, const MDBX_val *key, + const MDBX_val *data) { cASSERT(mc, (mc->mc_txn->mt_flags & MDBX_TXN_RDONLY) == 0); cASSERT(mc, (mc->mc_flags & C_INITIALIZED) || mc->mc_snum == 0); cASSERT(mc, cursor_is_tracked(mc)); - txn_lru_turn(mc->mc_txn); - - if (unlikely((*mc->mc_dbistate & DBI_DIRTY) == 0)) { - int err = touch_dbi(mc); - if (unlikely(err != MDBX_SUCCESS)) - return err; - } - if ((mc->mc_flags & C_SUB) == 0) { MDBX_txn *const txn = mc->mc_txn; + txn_lru_turn(txn); + + if (unlikely((*mc->mc_dbistate & DBI_DIRTY) == 0)) { + int err = touch_dbi(mc); + if (unlikely(err != MDBX_SUCCESS)) + return err; + } + /* Estimate how much space this operation will take: */ /* 1) Max b-tree height, reasonable enough with including dups' sub-tree */ size_t need = CURSOR_STACK + 3;