diff --git a/ChangeLog.md b/ChangeLog.md index 186ccc91..5152fc9d 100644 --- a/ChangeLog.md +++ b/ChangeLog.md @@ -23,6 +23,7 @@ ChangeLog Acknowledgements: - [gcxfd ](https://github.com/gcxfd) for reporting, contributing and testing. + - [장세연 (Чан Се Ен)](https://github.com/sasgas) for reporting and testing. 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. - Avoiding extra looping inside `mdbx_env_info_ex()`. - 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 diff --git a/src/core.c b/src/core.c index 85081cac..b8a1c5d5 100644 --- a/src/core.c +++ b/src/core.c @@ -12319,16 +12319,12 @@ __cold static int __must_check_result mdbx_override_meta( MDBX_SYNC_DATA | MDBX_SYNC_IODQ); if (unlikely(rc != MDBX_SUCCESS)) return rc; - MDBX_meta *live = METAPAGE(env, target); - mdbx_meta_update_begin(env, live, unaligned_peek_u64(4, model->mm_txnid_a)); + /* mdbx_override_meta() called only while current process have exclusive + * 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_meta_update_begin(env, model, - 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), + rc = mdbx_msync(&env->me_dxb_mmap, 0, pgno_align2os_bytes(env, target + 1), MDBX_SYNC_DATA | MDBX_SYNC_IODQ); } else { const mdbx_filehandle_t fd = (env->me_dsync_fd != INVALID_HANDLE_VALUE)