From 380385c1dbe0a1da121cb82c9998f3362b85bb32 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: Thu, 9 Jan 2025 22:51:08 +0300 Subject: [PATCH] =?UTF-8?q?mdbx:=20=D1=83=D0=BF=D1=80=D0=BE=D1=89=D0=B5?= =?UTF-8?q?=D0=BD=D0=B8=D0=B5=20=D0=B2=D1=8B=D1=85=D0=BE=D0=B4=D0=B0=20?= =?UTF-8?q?=D0=BF=D0=BE=20not-found=20=D0=BF=D1=83=D1=82=D0=B8=20=D0=B8?= =?UTF-8?q?=D0=B7=20`cursor=5Fseek()`.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/cursor.c | 7 ++++--- src/cursor.h | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/cursor.c b/src/cursor.c index 56a4487c..8f1bba85 100644 --- a/src/cursor.c +++ b/src/cursor.c @@ -638,7 +638,7 @@ static __always_inline int cursor_step(const bool inner, const bool forward, MDB inner_gone(mc); } else { if (mc->flags & z_hollow) { - cASSERT(mc, !inner_pointed(mc)); + cASSERT(mc, !inner_pointed(mc) || inner_hollow(mc)); return MDBX_ENODATA; } @@ -1818,8 +1818,9 @@ __hot csr_t cursor_seek(MDBX_cursor *mc, MDBX_val *key, MDBX_val *data, MDBX_cur * Поэтому переводим курсор в неустановленное состояние, но без сброса * top, что позволяет работать fastpath при последующем поиске по дереву * страниц. */ - mc->flags = z_hollow | (mc->flags & z_clear_mask); - inner_gone(mc); + mc->flags |= z_hollow; + if (inner_pointed(mc)) + mc->subcur->cursor.flags |= z_hollow; ret.err = MDBX_NOTFOUND; return ret; } diff --git a/src/cursor.h b/src/cursor.h index ece1866d..a55f1377 100644 --- a/src/cursor.h +++ b/src/cursor.h @@ -151,7 +151,7 @@ MDBX_MAYBE_UNUSED MDBX_NOTHROW_PURE_FUNCTION static inline bool is_hollow(const cASSERT(mc, mc->top >= 0); cASSERT(mc, (mc->flags & z_eof_hard) || mc->ki[mc->top] < page_numkeys(mc->pg[mc->top])); } else if (mc->subcur) - cASSERT(mc, is_poor(&mc->subcur->cursor)); + cASSERT(mc, is_poor(&mc->subcur->cursor) || (is_pointed(mc) && mc->subcur->cursor.flags < 0)); return r; }