From 71c3d20c01414ec5f6d15f56ae1e4fc2136334d5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9B=D0=B5=D0=BE=D0=BD=D0=B8=D0=B4=20=D0=AE=D1=80=D1=8C?= =?UTF-8?q?=D0=B5=D0=B2=20=28Leonid=20Yuriev=29?= Date: Sun, 31 Jul 2022 23:58:22 +0300 Subject: [PATCH 1/5] mdbx: skip extra cycle during search of page sequence. --- src/core.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/core.c b/src/core.c index 8276f143..c1cbe0b1 100644 --- a/src/core.c +++ b/src/core.c @@ -6608,9 +6608,9 @@ no_loose: while (true) { if (re_list[range_begin - wanna_range] - pgno == wanna_range) goto done; - if (range_begin == wanna_range) + if (--range_begin == wanna_range) break; - pgno = re_list[--range_begin]; + pgno = re_list[range_begin]; } #endif /* MDBX_PNL sort-order */ } From a441c9ffb1cb0f09e1193ca209e0a3aa818740fa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9B=D0=B5=D0=BE=D0=BD=D0=B8=D0=B4=20=D0=AE=D1=80=D1=8C?= =?UTF-8?q?=D0=B5=D0=B2=20=28Leonid=20Yuriev=29?= Date: Mon, 1 Aug 2022 14:44:33 +0300 Subject: [PATCH 2/5] mdbx: logging pgno of invalid root pages inside `meta_checktxnid()`. --- src/core.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/core.c b/src/core.c index c1cbe0b1..a3fe4842 100644 --- a/src/core.c +++ b/src/core.c @@ -7772,9 +7772,9 @@ static bool meta_checktxnid(const MDBX_env *env, const MDBX_meta *meta, if (unlikely(root_txnid != freedb_mod_txnid)) { if (report) mdbx_warning( - "catch invalid root_page_txnid %" PRIaTXN + "catch invalid root_page %" PRIaPGNO " mod_txnid %" PRIaTXN " for %sdb.mod_txnid %" PRIaTXN " %s", - root_txnid, "free", freedb_mod_txnid, + freedb_root_pgno, root_txnid, "free", freedb_mod_txnid, "(workaround for incoherent flaw of unified page/buffer cache)"); ok = false; } @@ -7787,9 +7787,9 @@ static bool meta_checktxnid(const MDBX_env *env, const MDBX_meta *meta, if (unlikely(root_txnid != maindb_mod_txnid)) { if (report) mdbx_warning( - "catch invalid root_page_txnid %" PRIaTXN + "catch invalid root_page %" PRIaPGNO " mod_txnid %" PRIaTXN " for %sdb.mod_txnid %" PRIaTXN " %s", - root_txnid, "main", maindb_mod_txnid, + maindb_root_pgno, root_txnid, "main", maindb_mod_txnid, "(workaround for incoherent flaw of unified page/buffer cache)"); ok = false; } From e444c70cb719a7d715736f76533939892e230b5c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9B=D0=B5=D0=BE=D0=BD=D0=B8=D0=B4=20=D0=AE=D1=80=D1=8C?= =?UTF-8?q?=D0=B5=D0=B2=20=28Leonid=20Yuriev=29?= Date: Tue, 2 Aug 2022 12:00:30 +0300 Subject: [PATCH 3/5] mdbx: release v0.11.9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The stable bugfix release. It is planned that this will be the last release of the v0.11 branch. Acknowledgements: ----------------- - [Alex Sharov](https://github.com/AskAlexSharov) and Erigon team for reporting and testing. - [Andrew Ashikhmin](https://gitflic.ru/user/yperbasis) for contributing. New: ---- - Ability to customise `MDBX_LOCK_SUFFIX`, `MDBX_DATANAME`, `MDBX_LOCKNAME` just by predefine ones during build. - Added to [`mdbx::env_managed`](https://libmdbx.dqdkfa.ru/group__cxx__api.html#classmdbx_1_1env__managed)'s methods a few overloads with `const char* pathname` parameter (C++ API). Fixes: ------ - Fixed hang copy-with-compactification of a corrupted DB or in case the volume of output pages is a multiple of `MDBX_ENVCOPY_WRITEBUF`. - Fixed standalone non-CMake build on MacOS (`#include AvailabilityMacros.h>`). - Fixed unexpected `MDBX_PAGE_FULL` error in rare cases with large database page sizes. Minors: ------- - Minor fixes Doxygen references, comments, descriptions, etc. - Fixed copy&paste typo inside `meta_checktxnid()`. - Minor fix `meta_checktxnid()` to avoid assertion in debug mode. - Minor fix `mdbx_env_set_geometry()` to avoid returning `EINVAL` in particular rare cases. - Minor refine/fix batch-get testcase for large page size. - Added `--pagesize NN` option to long-stotastic test script. - Updated Valgrind-suppressions file for modern GCC. - Fixed `has no symbols` warning from Apple's ranlib. 18 files changed, 318 insertions(+), 178 deletions(-) Signed-off-by: Леонид Юрьев (Leonid Yuriev) --- ChangeLog.md | 7 ++++++- src/man1/mdbx_chk.1 | 2 +- src/man1/mdbx_copy.1 | 2 +- src/man1/mdbx_drop.1 | 2 +- src/man1/mdbx_dump.1 | 2 +- src/man1/mdbx_load.1 | 2 +- src/man1/mdbx_stat.1 | 2 +- 7 files changed, 12 insertions(+), 7 deletions(-) diff --git a/ChangeLog.md b/ChangeLog.md index 6a970026..5d262e4e 100644 --- a/ChangeLog.md +++ b/ChangeLog.md @@ -1,11 +1,16 @@ ChangeLog --------- -## v0.11.9 (Чирчик-1992) scheduled to 2022-08-02 +## v0.11.9 (Чирчик-1992) at 2022-08-02 The stable bugfix release. It is planned that this will be the last release of the v0.11 branch. +``` +18 files changed, 318 insertions(+), 178 deletions(-) +Signed-off-by: Леонид Юрьев (Leonid Yuriev) +``` + Acknowledgements: - [Alex Sharov](https://github.com/AskAlexSharov) and Erigon team for reporting and testing. diff --git a/src/man1/mdbx_chk.1 b/src/man1/mdbx_chk.1 index c352c38f..69d9ffe7 100644 --- a/src/man1/mdbx_chk.1 +++ b/src/man1/mdbx_chk.1 @@ -1,6 +1,6 @@ .\" Copyright 2015-2022 Leonid Yuriev . .\" Copying restrictions apply. See COPYRIGHT/LICENSE. -.TH MDBX_CHK 1 "2022-04-22" "MDBX 0.11.8" +.TH MDBX_CHK 1 "2022-08-02" "MDBX 0.11.9" .SH NAME mdbx_chk \- MDBX checking tool .SH SYNOPSIS diff --git a/src/man1/mdbx_copy.1 b/src/man1/mdbx_copy.1 index 54512620..b4cfd4e9 100644 --- a/src/man1/mdbx_copy.1 +++ b/src/man1/mdbx_copy.1 @@ -2,7 +2,7 @@ .\" Copyright 2012-2015 Howard Chu, Symas Corp. All Rights Reserved. .\" Copyright 2015,2016 Peter-Service R&D LLC . .\" Copying restrictions apply. See COPYRIGHT/LICENSE. -.TH MDBX_COPY 1 "2022-04-22" "MDBX 0.11.8" +.TH MDBX_COPY 1 "2022-08-02" "MDBX 0.11.9" .SH NAME mdbx_copy \- MDBX environment copy tool .SH SYNOPSIS diff --git a/src/man1/mdbx_drop.1 b/src/man1/mdbx_drop.1 index d8859a57..df0b2c94 100644 --- a/src/man1/mdbx_drop.1 +++ b/src/man1/mdbx_drop.1 @@ -1,7 +1,7 @@ .\" Copyright 2021-2022 Leonid Yuriev . .\" Copyright 2014-2021 Howard Chu, Symas Corp. All Rights Reserved. .\" Copying restrictions apply. See COPYRIGHT/LICENSE. -.TH MDBX_DROP 1 "2022-04-22" "MDBX 0.11.8" +.TH MDBX_DROP 1 "2022-08-02" "MDBX 0.11.9" .SH NAME mdbx_drop \- MDBX database delete tool .SH SYNOPSIS diff --git a/src/man1/mdbx_dump.1 b/src/man1/mdbx_dump.1 index 403b2fab..bbcce115 100644 --- a/src/man1/mdbx_dump.1 +++ b/src/man1/mdbx_dump.1 @@ -2,7 +2,7 @@ .\" Copyright 2014-2015 Howard Chu, Symas Corp. All Rights Reserved. .\" Copyright 2015,2016 Peter-Service R&D LLC . .\" Copying restrictions apply. See COPYRIGHT/LICENSE. -.TH MDBX_DUMP 1 "2022-04-22" "MDBX 0.11.8" +.TH MDBX_DUMP 1 "2022-08-02" "MDBX 0.11.9" .SH NAME mdbx_dump \- MDBX environment export tool .SH SYNOPSIS diff --git a/src/man1/mdbx_load.1 b/src/man1/mdbx_load.1 index 01c58b01..cb35d4d1 100644 --- a/src/man1/mdbx_load.1 +++ b/src/man1/mdbx_load.1 @@ -2,7 +2,7 @@ .\" Copyright 2014-2015 Howard Chu, Symas Corp. All Rights Reserved. .\" Copyright 2015,2016 Peter-Service R&D LLC . .\" Copying restrictions apply. See COPYRIGHT/LICENSE. -.TH MDBX_LOAD 1 "2022-04-22" "MDBX 0.11.8" +.TH MDBX_LOAD 1 "2022-08-02" "MDBX 0.11.9" .SH NAME mdbx_load \- MDBX environment import tool .SH SYNOPSIS diff --git a/src/man1/mdbx_stat.1 b/src/man1/mdbx_stat.1 index f2ebbcf9..9dfa9379 100644 --- a/src/man1/mdbx_stat.1 +++ b/src/man1/mdbx_stat.1 @@ -2,7 +2,7 @@ .\" Copyright 2012-2015 Howard Chu, Symas Corp. All Rights Reserved. .\" Copyright 2015,2016 Peter-Service R&D LLC . .\" Copying restrictions apply. See COPYRIGHT/LICENSE. -.TH MDBX_STAT 1 "2022-04-22" "MDBX 0.11.8" +.TH MDBX_STAT 1 "2022-08-02" "MDBX 0.11.9" .SH NAME mdbx_stat \- MDBX environment status tool .SH SYNOPSIS From 06734bf8ffd94842b13e72cc65836f347fa585f0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9B=D0=B5=D0=BE=D0=BD=D0=B8=D0=B4=20=D0=AE=D1=80=D1=8C?= =?UTF-8?q?=D0=B5=D0=B2=20=28Leonid=20Yuriev=29?= Date: Sat, 6 Aug 2022 13:19:49 +0300 Subject: [PATCH 4/5] mdbx: don't check owner for finished transactions. --- src/core.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/core.c b/src/core.c index a3fe4842..13a02338 100644 --- a/src/core.c +++ b/src/core.c @@ -8152,13 +8152,17 @@ static __always_inline int check_txn(const MDBX_txn *txn, int bad_bits) { if (unlikely(txn->mt_flags & bad_bits)) return MDBX_BAD_TXN; + mdbx_tassert(txn, (txn->mt_flags & MDBX_NOTLS) == + ((txn->mt_flags & MDBX_TXN_RDONLY) + ? txn->mt_env->me_flags & MDBX_NOTLS + : 0)); #if MDBX_TXN_CHECKOWNER - if ((txn->mt_flags & MDBX_NOTLS) == 0 && - unlikely(txn->mt_owner != mdbx_thread_self())) + if (unlikely(txn->mt_owner != mdbx_thread_self()) && + (txn->mt_flags & (MDBX_NOTLS | MDBX_TXN_FINISHED)) == 0) return txn->mt_owner ? MDBX_THREAD_MISMATCH : MDBX_BAD_TXN; #endif /* MDBX_TXN_CHECKOWNER */ - if (unlikely(!txn->mt_env->me_map)) + if (bad_bits && unlikely(!txn->mt_env->me_map)) return MDBX_EPERM; return MDBX_SUCCESS; From f0a46da6a5af4c8897008752e0a1e274db0eae73 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9B=D0=B5=D0=BE=D0=BD=D0=B8=D0=B4=20=D0=AE=D1=80=D1=8C?= =?UTF-8?q?=D0=B5=D0=B2=20=28Leonid=20Yuriev=29?= Date: Sat, 6 Aug 2022 19:35:09 +0300 Subject: [PATCH 5/5] mdbx-make: using `ldd` to check used dso. --- GNUmakefile | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/GNUmakefile b/GNUmakefile index 59d7b8d9..ed7496cc 100644 --- a/GNUmakefile +++ b/GNUmakefile @@ -808,13 +808,13 @@ else define bench-rule bench-$(1)_$(2).txt: $(3) $(IOARENA) $(lastword $(MAKEFILE_LIST)) @echo ' RUNNING ioarena for $1/$2...' - $(QUIET)LD_LIBRARY_PATH="./:$$$${LD_LIBRARY_PATH}" \ + $(QUIET)(export LD_LIBRARY_PATH="./:$$$${LD_LIBRARY_PATH}"; \ + ldd $(IOARENA) && \ $(IOARENA) -D $(1) -B crud -m $(BENCH_CRUD_MODE) -n $(2) \ - | tee $$@ | grep throughput && \ - LD_LIBRARY_PATH="./:$$$${LD_LIBRARY_PATH}" \ - $(IOARENA) -D $(1) -B get,iterate -m $(BENCH_CRUD_MODE) -r 4 -n $(2) \ - | tee -a $$@ | grep throughput \ - || mv -f $$@ $$@.error + | tee $$@ | grep throughput && \ + $(IOARENA) -D $(1) -B iterate,get,iterate,get,iterate -m $(BENCH_CRUD_MODE) -r 4 -n $(2) \ + | tee -a $$@ | grep throughput \ + ) || mv -f $$@ $$@.error endef