mdbx: merge branch 'master' into devel-rebase.

Change-Id: I96d944f283029b9c60e45683ee66b4564273b407
This commit is contained in:
Leonid Yuriev 2021-01-19 23:51:52 +03:00
commit a906569c58
5 changed files with 12 additions and 12 deletions

3
.gitignore vendored
View File

@ -8,6 +8,9 @@
*.orig *.orig
*.rej *.rej
*.so *.so
*.dll
*.dylib
*.dSYM
*[~#] *[~#]
.idea .idea
.le.ini .le.ini

View File

@ -30,10 +30,10 @@ New features:
Fixes: Fixes:
- Fixed 4-byte aligned access to 64-bit integers.
- Fixed missing cleanup (null assigned) in the C++ commit/abort (https://github.com/erthink/libmdbx/pull/143). - Fixed missing cleanup (null assigned) in the C++ commit/abort (https://github.com/erthink/libmdbx/pull/143).
- Fixed `mdbx_realloc()` for case of nullptr and `MDBX_AVOID_CRT=ON` for Windows. - Fixed `mdbx_realloc()` for case of nullptr and `MDBX_AVOID_CRT=ON` for Windows.
- Fixed the possibility to use invalid and renewed (closed & re-opened, dropped & re-created) DBI-handles (https://github.com/erthink/libmdbx/issues/146). - Fixed the possibility to use invalid and renewed (closed & re-opened, dropped & re-created) DBI-handles (https://github.com/erthink/libmdbx/issues/146).
- Fixed 4-byte aligned access to 64-bit integers, including access to the `bootid` meta-page's field (https://github.com/erthink/libmdbx/issues/153).
## v0.9.2 scheduled at 2020-11-27 ## v0.9.2 scheduled at 2020-11-27

View File

@ -72,7 +72,7 @@ strip: all
strip libmdbx.$(SO_SUFFIX) $(TOOLS) strip libmdbx.$(SO_SUFFIX) $(TOOLS)
clean: clean:
rm -rf $(TOOLS) mdbx_test @* *.[ao] *.[ls]o *~ tmp.db/* \ rm -rf $(TOOLS) mdbx_test @* *.[ao] *.[ls]o *.$(SO_SUFFIX) *.dSYM *~ tmp.db/* \
*.gcov *.log *.err src/*.o test/*.o mdbx_example dist \ *.gcov *.log *.err src/*.o test/*.o mdbx_example dist \
config.h src/config.h src/version.c *.tar* config.h src/config.h src/version.c *.tar*

2
mdbx.h
View File

@ -823,7 +823,7 @@ DEFINE_ENUM_FLAG_OPERATORS(MDBX_debug_flags_t)
* \param [in] env An environment handle returned by \ref mdbx_env_create(). * \param [in] env An environment handle returned by \ref mdbx_env_create().
* \param [in] msg The assertion message, not including newline. */ * \param [in] msg The assertion message, not including newline. */
typedef void MDBX_debug_func(MDBX_log_level_t loglevel, const char *function, typedef void MDBX_debug_func(MDBX_log_level_t loglevel, const char *function,
int line, const char *msg, int line, const char *fmt,
va_list args) MDBX_CXX17_NOEXCEPT; va_list args) MDBX_CXX17_NOEXCEPT;
/** \brief The "don't change `logger`" value for mdbx_setup_debug() */ /** \brief The "don't change `logger`" value for mdbx_setup_debug() */

View File

@ -4415,7 +4415,7 @@ bailout:
/*----------------------------------------------------------------------------*/ /*----------------------------------------------------------------------------*/
static __always_inline bool meta_bootid_match(const MDBX_meta *meta) { static __always_inline bool meta_bootid_match(const MDBX_meta *meta) {
return meta->mm_bootid.x == bootid.x && meta->mm_bootid.y == bootid.y && return memcmp(&meta->mm_bootid, &bootid, 16) == 0 &&
(bootid.x | bootid.y) != 0; (bootid.x | bootid.y) != 0;
} }
@ -4467,7 +4467,7 @@ static __inline void mdbx_meta_update_end(const MDBX_env *env, MDBX_meta *meta,
mdbx_assert(env, unaligned_peek_u64(4, meta->mm_txnid_b) < txnid); mdbx_assert(env, unaligned_peek_u64(4, meta->mm_txnid_b) < txnid);
(void)env; (void)env;
mdbx_jitter4testing(true); mdbx_jitter4testing(true);
meta->mm_bootid = bootid; memcpy(&meta->mm_bootid, &bootid, 16);
unaligned_poke_u64(4, meta->mm_txnid_b, txnid); unaligned_poke_u64(4, meta->mm_txnid_b, txnid);
} }
@ -4477,7 +4477,7 @@ static __inline void mdbx_meta_set_txnid(const MDBX_env *env, MDBX_meta *meta,
(void)env; (void)env;
/* update inconsistent since this function used ONLY for filling meta-image /* update inconsistent since this function used ONLY for filling meta-image
* for writing, but not the actual meta-page */ * for writing, but not the actual meta-page */
meta->mm_bootid = bootid; memcpy(&meta->mm_bootid, &bootid, 16);
unaligned_poke_u64(4, meta->mm_txnid_a, txnid); unaligned_poke_u64(4, meta->mm_txnid_a, txnid);
unaligned_poke_u64(4, meta->mm_txnid_b, txnid); unaligned_poke_u64(4, meta->mm_txnid_b, txnid);
} }
@ -17328,12 +17328,9 @@ __cold int mdbx_env_info_ex(const MDBX_env *env, const MDBX_txn *txn,
arg->mi_meta2_txnid = mdbx_meta_txnid_fluid(env, meta2); arg->mi_meta2_txnid = mdbx_meta_txnid_fluid(env, meta2);
arg->mi_meta2_sign = unaligned_peek_u64(4, meta2->mm_datasync_sign); arg->mi_meta2_sign = unaligned_peek_u64(4, meta2->mm_datasync_sign);
if (likely(bytes > size_before_bootid)) { if (likely(bytes > size_before_bootid)) {
arg->mi_bootid.meta0.x = meta0->mm_bootid.x; memcpy(&arg->mi_bootid.meta0, &meta0->mm_bootid, 16);
arg->mi_bootid.meta1.x = meta0->mm_bootid.x; memcpy(&arg->mi_bootid.meta1, &meta1->mm_bootid, 16);
arg->mi_bootid.meta2.x = meta0->mm_bootid.x; memcpy(&arg->mi_bootid.meta2, &meta2->mm_bootid, 16);
arg->mi_bootid.meta0.y = meta0->mm_bootid.y;
arg->mi_bootid.meta1.y = meta0->mm_bootid.y;
arg->mi_bootid.meta2.y = meta0->mm_bootid.y;
} }
const MDBX_meta *txn_meta = recent_meta; const MDBX_meta *txn_meta = recent_meta;