From 3da23da7b310fceca85fcad4c8dde5fa14aa525d 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: Mon, 9 Jan 2023 21:32:35 +0300 Subject: [PATCH] =?UTF-8?q?mdbx:=20=D0=BA=D0=BE=D1=81=D0=BC=D0=B5=D1=82?= =?UTF-8?q?=D0=B8=D1=87=D0=B5=D1=81=D0=BA=D0=B8=D0=B9=20=D1=80=D0=B5=D1=84?= =?UTF-8?q?=D0=B0=D0=BA=D1=82=D0=BE=D1=80=D0=B8=D0=BD=D0=B3=20=D0=BA=D0=BE?= =?UTF-8?q?=D0=BD=D1=82=D1=80=D0=BE=D0=BB=D1=8F=20`MDBX=5FAPPEND`.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/core.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/core.c b/src/core.c index 1a3ab15d..c17553a0 100644 --- a/src/core.c +++ b/src/core.c @@ -17172,15 +17172,15 @@ static __hot int cursor_put_nochecklen(MDBX_cursor *mc, const MDBX_val *key, if ((flags & MDBX_APPEND) && mc->mc_db->md_entries > 0) { rc = cursor_last(mc, &dkey, &olddata); if (likely(rc == MDBX_SUCCESS)) { - rc = mc->mc_dbx->md_cmp(key, &dkey); - if (likely(rc > 0)) { + const int cmp = mc->mc_dbx->md_cmp(key, &dkey); + if (likely(cmp > 0)) { mc->mc_ki[mc->mc_top]++; /* step forward for appending */ rc = MDBX_NOTFOUND; + } else if (unlikely(cmp != 0)) { + /* new-key < last-key */ + return MDBX_EKEYMISMATCH; } else { - if (unlikely(rc != MDBX_SUCCESS)) - /* new-key < last-key - * or new-key == last-key without MDBX_APPENDDUP */ - return MDBX_EKEYMISMATCH; + rc = MDBX_SUCCESS; exact = true; } }