From 839da86cac604365747ee785e517029007ca7d96 Mon Sep 17 00:00:00 2001 From: Leonid Yuriev Date: Tue, 7 Dec 2021 00:14:22 +0300 Subject: [PATCH] mdbx: minor fix handling `MDBX_SET_LOWERBOUND` to avoid `MDBX_BAD_VALSIZE`. Related to https://github.com/erthink/libmdbx/issues/248#issuecomment-986542620. --- src/core.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/core.c b/src/core.c index 7982e1f7..c36660be 100644 --- a/src/core.c +++ b/src/core.c @@ -14517,7 +14517,12 @@ int mdbx_cursor_get(MDBX_cursor *mc, MDBX_val *key, MDBX_val *data, rc = csr.err; if (rc == MDBX_SUCCESS && csr.exact && mc->mc_xcursor) { mc->mc_flags &= ~C_DEL; - if (mc->mc_xcursor->mx_cursor.mc_flags & C_INITIALIZED) { + csr.exact = false; + if (!save_data.iov_base && (mc->mc_db->md_flags & MDBX_DUPFIXED)) { + /* Avoiding search nested dupfixed hive if no data provided. + * This is changes the semantic of MDBX_SET_LOWERBOUND but avoid + * returning MDBX_BAD_VALSIZE. */ + } else if (mc->mc_xcursor->mx_cursor.mc_flags & C_INITIALIZED) { *data = save_data; csr = mdbx_cursor_set(&mc->mc_xcursor->mx_cursor, data, NULL, MDBX_SET_RANGE);