From a899056fd1c97eff0c19ae137d22ca213b2f6dd0 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, 6 Dec 2021 21:17:24 +0300 Subject: [PATCH] mdbx: fix extra assertion. Fixes https://github.com/erthink/libmdbx/issues/248. --- src/core.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/core.c b/src/core.c index f5283fdf..7982e1f7 100644 --- a/src/core.c +++ b/src/core.c @@ -14793,6 +14793,7 @@ int mdbx_cursor_put(MDBX_cursor *mc, const MDBX_val *key, MDBX_val *data, } } else { struct cursor_set_result csr = + /* olddata may not be updated in case LEAF2-page of dupfixed-subDB */ mdbx_cursor_set(mc, (MDBX_val *)key, &olddata, MDBX_SET); rc = csr.err; exact = csr.exact; @@ -14807,7 +14808,11 @@ int mdbx_cursor_put(MDBX_cursor *mc, const MDBX_val *key, MDBX_val *data, if (unlikely(mc->mc_flags & C_SUB)) { /* nested subtree of DUPSORT-database with the same key, * nothing to update */ - mdbx_assert(env, data->iov_len == 0 && olddata.iov_len == 0); + mdbx_assert(env, data->iov_len == 0 && + (olddata.iov_len == 0 || + /* olddata may not be updated in case LEAF2-page + of dupfixed-subDB */ + (mc->mc_db->md_flags & MDBX_DUPFIXED))); return MDBX_SUCCESS; } if (unlikely(flags & MDBX_ALLDUPS) && mc->mc_xcursor &&