mirror of
https://github.com/isar/libmdbx.git
synced 2025-01-02 00:24:13 +08:00
mdbx: fix mdbx_override_meta()
to avoid false-positive assertions.
Fixed https://github.com/erthink/libmdbx/issues/253.
This commit is contained in:
parent
29eb4c2bed
commit
c70d2d62d1
@ -23,6 +23,7 @@ ChangeLog
|
|||||||
Acknowledgements:
|
Acknowledgements:
|
||||||
|
|
||||||
- [gcxfd <i@rmw.link>](https://github.com/gcxfd) for reporting, contributing and testing.
|
- [gcxfd <i@rmw.link>](https://github.com/gcxfd) for reporting, contributing and testing.
|
||||||
|
- [장세연 (Чан Се Ен)](https://github.com/sasgas) for reporting and testing.
|
||||||
|
|
||||||
New features, extensions and improvements:
|
New features, extensions and improvements:
|
||||||
|
|
||||||
@ -43,6 +44,7 @@ Minors:
|
|||||||
- [Fixed](https://github.com/erthink/libmdbx/issues/248) extra assertion inside `mdbx_cursor_put()` for `MDBX_DUPFIXED` cases.
|
- [Fixed](https://github.com/erthink/libmdbx/issues/248) extra assertion inside `mdbx_cursor_put()` for `MDBX_DUPFIXED` cases.
|
||||||
- Avoiding extra looping inside `mdbx_env_info_ex()`.
|
- Avoiding extra looping inside `mdbx_env_info_ex()`.
|
||||||
- Explicitly enabled core dumps from stochastic tests scripts on Linux.
|
- Explicitly enabled core dumps from stochastic tests scripts on Linux.
|
||||||
|
- [Fixed](https://github.com/erthink/libmdbx/issues/253) `mdbx_override_meta()` to avoid false-positive assertions.
|
||||||
|
|
||||||
|
|
||||||
## v0.11.2 at 2021-12-02
|
## v0.11.2 at 2021-12-02
|
||||||
|
14
src/core.c
14
src/core.c
@ -12319,16 +12319,12 @@ __cold static int __must_check_result mdbx_override_meta(
|
|||||||
MDBX_SYNC_DATA | MDBX_SYNC_IODQ);
|
MDBX_SYNC_DATA | MDBX_SYNC_IODQ);
|
||||||
if (unlikely(rc != MDBX_SUCCESS))
|
if (unlikely(rc != MDBX_SUCCESS))
|
||||||
return rc;
|
return rc;
|
||||||
MDBX_meta *live = METAPAGE(env, target);
|
/* mdbx_override_meta() called only while current process have exclusive
|
||||||
mdbx_meta_update_begin(env, live, unaligned_peek_u64(4, model->mm_txnid_a));
|
* lock of a DB file. So meta-page could be updated directly without
|
||||||
|
* clearing consistency flag by mdbx_meta_update_begin() */
|
||||||
|
memcpy(pgno2page(env, target), page, env->me_psize);
|
||||||
mdbx_flush_incoherent_cpu_writeback();
|
mdbx_flush_incoherent_cpu_writeback();
|
||||||
mdbx_meta_update_begin(env, model,
|
rc = mdbx_msync(&env->me_dxb_mmap, 0, pgno_align2os_bytes(env, target + 1),
|
||||||
unaligned_peek_u64(4, model->mm_txnid_a));
|
|
||||||
unaligned_poke_u64(4, model->mm_datasync_sign, MDBX_DATASIGN_WEAK);
|
|
||||||
memcpy((void *)data_page(live), page, env->me_psize);
|
|
||||||
mdbx_meta_update_end(env, live, unaligned_peek_u64(4, model->mm_txnid_b));
|
|
||||||
mdbx_flush_incoherent_cpu_writeback();
|
|
||||||
rc = mdbx_msync(&env->me_dxb_mmap, 0, pgno_align2os_bytes(env, target),
|
|
||||||
MDBX_SYNC_DATA | MDBX_SYNC_IODQ);
|
MDBX_SYNC_DATA | MDBX_SYNC_IODQ);
|
||||||
} else {
|
} else {
|
||||||
const mdbx_filehandle_t fd = (env->me_dsync_fd != INVALID_HANDLE_VALUE)
|
const mdbx_filehandle_t fd = (env->me_dsync_fd != INVALID_HANDLE_VALUE)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user