mirror of
https://github.com/isar/libmdbx.git
synced 2025-01-04 19:54:13 +08:00
mdbx: fix put(MDBX_UPSERT+MDBX_ALLDUPS)
for case of replacement all values of a single key inside dupsorted subDb (backport).
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:
parent
6899142872
commit
51789f3605
@ -7,10 +7,17 @@ Fixes:
|
|||||||
|
|
||||||
- Fixed insignificant typo of `||` inside `#if` byte-order condition (backport).
|
- Fixed insignificant typo of `||` inside `#if` byte-order condition (backport).
|
||||||
|
|
||||||
- Fixed`SIGSEGV` or an erroneous call to `free()` in situations where
|
- Fixed `SIGSEGV` or an erroneous call to `free()` in situations where
|
||||||
errors occur when reopening by `mdbx_env_open()` of a previously used
|
errors occur when reopening by `mdbx_env_open()` of a previously used
|
||||||
environment (backport).
|
environment (backport).
|
||||||
|
|
||||||
|
- 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 (backport).
|
||||||
|
In this case, the database becomes completely empty, without any pages.
|
||||||
|
However exactly this condition was not considered and thus wasn't handled correctly.
|
||||||
|
See [issue#8](https://gitflic.ru/project/erthink/libmdbx/issue/8) for more information.
|
||||||
|
|
||||||
Minors:
|
Minors:
|
||||||
|
|
||||||
- Using the https://libmdbx.dqdkfa.ru/dead-github
|
- Using the https://libmdbx.dqdkfa.ru/dead-github
|
||||||
|
@ -15559,7 +15559,7 @@ int mdbx_cursor_put(MDBX_cursor *mc, const MDBX_val *key, MDBX_val *data,
|
|||||||
if (unlikely(rc != MDBX_SUCCESS))
|
if (unlikely(rc != MDBX_SUCCESS))
|
||||||
return rc;
|
return rc;
|
||||||
flags -= MDBX_ALLDUPS;
|
flags -= MDBX_ALLDUPS;
|
||||||
rc = MDBX_NOTFOUND;
|
rc = mc->mc_snum ? MDBX_NOTFOUND : MDBX_NO_ROOT;
|
||||||
exact = false;
|
exact = false;
|
||||||
} else /* checking for early exit without dirtying pages */
|
} else /* checking for early exit without dirtying pages */
|
||||||
if (!(flags & (MDBX_RESERVE | MDBX_MULTIPLE)) &&
|
if (!(flags & (MDBX_RESERVE | MDBX_MULTIPLE)) &&
|
||||||
|
Loading…
x
Reference in New Issue
Block a user