mirror of
https://github.com/isar/libmdbx.git
synced 2025-08-23 09:04:26 +08:00
mdbx: исправление put(MDBX_UPSERT+MDBX_ALLDUPS)
для случая замены всех значений в subDb.
Fixed cursor_put_nochecklen() internals for case when dupsort'ed named subDb contains a single key with multiple values (aka duplicates), which are replaced with a single value by put-operation with the `MDBX_UPSERT+MDBX_ALLDUPS` flags. In this case, the database becomes completely empty, without any pages. However exactly this condition was not considered and thus wasn't handled correctly. Fixes https://gitflic.ru/project/erthink/libmdbx/issue/8 Thanks Masatoshi Fukunaga <https://gitflic.ru/user/mah0x211> for reporting.
This commit is contained in:
@@ -17275,7 +17275,7 @@ static __hot int cursor_put_nochecklen(MDBX_cursor *mc, const MDBX_val *key,
|
||||
if (unlikely(err != MDBX_SUCCESS))
|
||||
return err;
|
||||
flags -= MDBX_ALLDUPS;
|
||||
rc = MDBX_NOTFOUND;
|
||||
rc = mc->mc_snum ? MDBX_NOTFOUND : MDBX_NO_ROOT;
|
||||
exact = false;
|
||||
} else if (!(flags & (MDBX_RESERVE | MDBX_MULTIPLE))) {
|
||||
/* checking for early exit without dirtying pages */
|
||||
|
Reference in New Issue
Block a user