2300 Commits

Author SHA1 Message Date
Леонид Юрьев (Leonid Yuriev)
52cb6b90a7 mdbx: fix extra check for MDBX_APPENDDUP. 2022-09-02 02:02:33 +03:00
Леонид Юрьев (Leonid Yuriev)
2d7c25b263 mdbx: minor fix extra ensure/assertion check of oldest_reader inside txn_end(). 2022-09-02 01:46:11 +03:00
Леонид Юрьев (Leonid Yuriev)
b73727d73e mdbx: add MDBX_HAVE_BUILTIN_CPU_SUPPORTS build option. 2022-08-26 19:17:09 +03:00
Леонид Юрьев (Leonid Yuriev)
b36a07a512
mdbx: release v0.12.1 (Positive Proxima)
The planned frontward release with new superior features on the day of 20 anniversary of [Positive Technologies](https://ptsecurty.com).

New:
----

 - The `Big Foot` feature which significantly reduces GC overhead for processing large lists of retired pages from huge transactions.
   Now _libmdbx_ avoid creating large chunks of PNLs (page number lists) which required a long sequences of free pages, aka large/overflow pages.
   Thus avoiding searching, allocating and storing such sequences inside GC.
 - Improved hot/online validation and checking of database pages both for more robustness and performance.
 - New solid and fast method to latch meta-pages called `Troika`.
   The minimum of memory barriers, reads, comparisons and conditional transitions are used.
 - New `MDBX_VALIDATION` environment options to extra validation of DB structure and pages content for carefully/safe handling damaged or untrusted DB.
 - Accelerated ×16/×8/×4 by AVX512/AVX2/SSE2/Neon implementations of search page sequences.
 - Added the `gcrtime_seconds16dot16` counter to the "Page Operation Statistics" that accumulates time spent for GC searching and reclaiming.
 - Copy-with-compactification now clears/zeroes unused gaps inside database pages.
 - The `C` and `C++` APIs has been extended and/or refined to simplify using `wchar_t` pathnames.
   On Windows the `mdbx_env_openW()`, `mdbx_env_get_pathW()`, `mdbx_env_copyW()`, `mdbx_env_open_for_recoveryW()` are available for now,
   but the `mdbx_env_get_path()` has been replaced in favor of `mdbx_env_get_pathW()`.
 - Added explicit error message for Buildroot's Microblaze toolchain maintainers.
 - Added `MDBX_MANAGE_BUILD_FLAGS` build options for CMake.
 - Speed-up internal `bsearch`/`lower_bound` implementation using branchless tactic, including workaround for CLANG x86 optimiser bug.
 - A lot internal refinement and micro-optimisations.
 - Internally counted volume of dirty pages (unused for now but for coming features).

Fixes:
------

 - Never use modern `__cxa_thread_atexit()` on Apple's OSes.
 - Don't check owner for finished transactions.
 - Fixed typo in `MDBX_EINVAL` which breaks MingGW builds with CLANG.

37 files changed, 7604 insertions(+), 7417 deletions(-)
Signed-off-by: Леонид Юрьев (Leonid Yuriev) <leo@yuriev.ru>
2022-08-24 16:24:22 +03:00
Леонид Юрьев (Leonid Yuriev)
b60d8e78c3 mdbx: merge branch master into devel. 2022-08-22 21:46:54 +03:00
Леонид Юрьев (Leonid Yuriev)
aaa9112c83
mdbx: release v0.11.10
The stable bugfix release.
It is planned that this will be the last release of the v0.11 branch.

New:
----

 - The C++ API has been refined to simplify support for `wchar_t` in path names.
 - Added explicit error message for Buildroot's Microblaze toolchain maintainers.

Fixes:
------

 - Never use modern `__cxa_thread_atexit()` on Apple's OSes.
 - Use `MultiByteToWideChar(CP_THREAD_ACP)` instead of `mbstowcs()`.
 - Don't check owner for finished transactions.
 - Fixed typo in `MDBX_EINVAL` which breaks MingGW builds with CLANG.

Minors:
-------

 - Fixed variable name typo.
 - Using `ldd` to check used dso.
 - Added `MDBX_WEAK_IMPORT_ATTRIBUTE` macro.
 - Use current transaction geometry for untouched parameters when `env_set_geometry()` called within a write transaction.
 - Minor clarified `iov_page()` failure case.

14 files changed, 263 insertions(+), 252 deletions(-)
Signed-off-by: Леонид Юрьев (Leonid Yuriev) <leo@yuriev.ru>
2022-08-22 13:32:24 +03:00
Леонид Юрьев (Leonid Yuriev)
26f52a19c3 mdbx: add explicit error message for Buildroot's Microblaze toolchain maintainers. 2022-08-22 12:59:42 +03:00
Леонид Юрьев (Leonid Yuriev)
5368551081 mdbx: minor clarify iov_page() failure case. 2022-08-22 12:59:42 +03:00
Леонид Юрьев (Leonid Yuriev)
0ccec20409 mdbx: don't deem meta pages with zero txnid equal.
Устранение крайне маловероятного регресса после перехода на мета-тройку:
 - процесс А открыает БД и читает мета-траницы для формирования тройки;
 - процесс Б постоянно коммитит новые транзакции;
 - есть шанс что процесс А при чтении разных мета страниц попадет на момент их обновления более одного раза,
   это может привести к ложной ошибке коллизии мета-страниц,
   так как для обновляемых мета-страниц будет виден нулевой номер транзакции.
2022-08-20 01:54:11 +03:00
Леонид Юрьев (Leonid Yuriev)
ceba040e32 mdbx: add meta_xyz_dump(). 2022-08-20 01:54:11 +03:00
Леонид Юрьев (Leonid Yuriev)
b617f25eaa mdbx: refine & rename internal xyz to troika. 2022-08-20 01:54:06 +03:00
Леонид Юрьев (Leonid Yuriev)
b759dfafd7 mdbx: counting large/overflow dirty pages (unused for now).
This is a basis for [Large/Overflow pages accounting for dirty-room](https://web.archive.org/web/20220414235959/https://github.com/erthink/libmdbx/issues/192).
2022-08-20 00:14:48 +03:00
Леонид Юрьев (Leonid Yuriev)
4cef1c2376 mdbx: avoid extra using F_ISSET() macro. 2022-08-18 01:39:06 +03:00
Леонид Юрьев (Leonid Yuriev)
08a8f844dc mdbx: ×4 ARM-Neon accelerated scan4seq(). 2022-08-18 01:10:27 +03:00
Леонид Юрьев (Leonid Yuriev)
8e2c276562 mdbx: merge branch 'master' into devel branch. 2022-08-18 01:04:35 +03:00
Леонид Юрьев (Leonid Yuriev)
7b36f946cb mdbx: rework/speed up accessing to meta-pages, choosing and cache of ones (squashed). 2022-08-17 21:39:22 +03:00
Леонид Юрьев (Leonid Yuriev)
ef16dd2a22 mdbx: move global_ctor() to the end . 2022-08-17 21:31:11 +03:00
Леонид Юрьев (Leonid Yuriev)
f9ad835680 mdbx: drop E2K libc obsolete workarounds. 2022-08-17 21:29:51 +03:00
Леонид Юрьев (Leonid Yuriev)
9b3faee630 mdbx: drop obsolete Nexenta attributes API. 2022-08-17 21:29:51 +03:00
Леонид Юрьев (Leonid Yuriev)
316ddf9e01 mdbx: fix typo in MDBX_EINVAL which breaks MingGW builds with CLANG. 2022-08-16 11:09:52 +03:00
Леонид Юрьев (Leonid Yuriev)
3fbbe32adf mdbx: fix checking owner for finished write transactions inside txn_abort().
Fixed regression after 06734bf8ffd94842b13e72cc65836f347fa585f0.
2022-08-14 12:39:21 +03:00
Леонид Юрьев (Leonid Yuriev)
8467cc6d03 mdbx: use current txn geo for untouched parameters when env_set_geometry() called within a write transaction. 2022-08-13 16:56:29 +03:00
Леонид Юрьев (Leonid Yuriev)
9f0e2ecc67 mdbx: fix variable name typo. 2022-08-13 16:56:09 +03:00
Леонид Юрьев (Leonid Yuriev)
1c5ef060c5 mdbx: reduce number of memory fences in the hot paths. 2022-08-11 18:45:00 +03:00
Леонид Юрьев (Leonid Yuriev)
34a4e7e102 mdbx: avoid Valgrind warnings. 2022-08-11 17:10:13 +03:00
Леонид Юрьев (Leonid Yuriev)
ae730ae2f3 mdbx: fix minor warnings for ASAN-enabled builds. 2022-08-11 12:33:56 +03:00
Леонид Юрьев (Leonid Yuriev)
18e557c6e8 mdbx: rename internal functions, types and macros (to be closer to MithrilDB). 2022-08-11 12:33:56 +03:00
Леонид Юрьев (Leonid Yuriev)
096d6a9bd6 mdbx: some micro-optimizations. 2022-08-10 22:09:42 +03:00
Леонид Юрьев (Leonid Yuriev)
d8f0c9dc44 mdbx: more __hot. 2022-08-10 15:46:45 +03:00
Леонид Юрьев (Leonid Yuriev)
78dc699709 mdbx: add ×16 accelerated scan4seq() (AVX512BW). 2022-08-10 13:23:04 +03:00
Леонид Юрьев (Leonid Yuriev)
c2bf9ebf17 mdbx: minor refine AVX2/SSE2-accelerated scan4seq(). 2022-08-10 11:43:24 +03:00
Леонид Юрьев (Leonid Yuriev)
3c28619562 mdbx: merge branch master into devel. 2022-08-09 19:04:27 +03:00
Леонид Юрьев (Leonid Yuriev)
0287a00ee3 mdbx++: refine/simplify wchar_t support for pathnames. 2022-08-09 18:54:22 +03:00
Леонид Юрьев (Leonid Yuriev)
2ff8d3c4f2 mdbx: native wchar_t pathname for Windows. 2022-08-09 18:27:43 +03:00
Леонид Юрьев (Leonid Yuriev)
98c53555ab mdbx: using e2k-frendly/cmov/branch-less bsearch.
https://gitflic.ru/project/erthink/bsearch-try
2022-08-09 18:25:05 +03:00
Леонид Юрьев (Leonid Yuriev)
c8b1392cbe mdbx: use MultiByteToWideChar(CP_THREAD_ACP) instead of mbstowcs(). 2022-08-09 16:12:24 +03:00
Леонид Юрьев (Leonid Yuriev)
6d85e35876 mdbx: never use modern __cxa_thread_atexit() on Apple's OSes. 2022-08-08 15:23:39 +03:00
Леонид Юрьев (Leonid Yuriev)
dd01aabaeb mdbx: add MDBX_WEAK_IMPORT_ATTRIBUTE macro. 2022-08-08 15:18:16 +03:00
Леонид Юрьев (Leonid Yuriev)
3de759a7be mdbx: fix page-boundary checking inside accelerated scan4seq(). 2022-08-07 22:24:00 +03:00
Леонид Юрьев (Leonid Yuriev)
d6603a0c0a mdbx: add ×8 accelerated scan4seq() (AVX2). 2022-08-07 17:08:51 +03:00
Леонид Юрьев (Leonid Yuriev)
15146d3823 mdbx: fix scan4seq() selection for non-implemented cases. 2022-08-07 15:14:50 +03:00
Леонид Юрьев (Leonid Yuriev)
d62d3e2aab mdbx: merge branch master into devel. 2022-08-07 12:42:43 +03:00
Леонид Юрьев (Leonid Yuriev)
fa854e40c3 mdbx: refine checking inside page_get(). 2022-08-07 12:29:51 +03:00
Леонид Юрьев (Leonid Yuriev)
5afc5c4e8c mdbx: reorganize/move fences to reduce overhead. 2022-08-07 12:29:51 +03:00
Леонид Юрьев (Leonid Yuriev)
c05a3b7bb9 mdbx: minor refine node_add(). 2022-08-07 12:29:50 +03:00
Леонид Юрьев (Leonid Yuriev)
1215bda188 mdbx: minor refine/speedup node_del(). 2022-08-07 12:29:50 +03:00
Леонид Юрьев (Leonid Yuriev)
0dd4532473 mdbx: reduce gap/backlog of linear scan inside dpl_search(). 2022-08-07 12:29:50 +03:00
Леонид Юрьев (Leonid Yuriev)
eac3d0499f mdbx: minor refine/speedup dpl_sort_slowpath(). 2022-08-07 12:29:50 +03:00
Леонид Юрьев (Leonid Yuriev)
a11c045f1e mdbx: using expect_with_probability() macro. 2022-08-07 12:28:35 +03:00
Леонид Юрьев (Leonid Yuriev)
c0f8ecd6f2 mdbx: add expect_with_probability() macro. 2022-08-07 11:56:23 +03:00
Леонид Юрьев (Leonid Yuriev)
8404cc1fd7 mdbx: reduce sorting-network to 8. 2022-08-07 11:56:23 +03:00
Леонид Юрьев (Leonid Yuriev)
654b020bc7 mdbx: add __restrict to quicksort internal pointers. 2022-08-07 11:56:23 +03:00
Леонид Юрьев (Leonid Yuriev)
77635116c6 mdbx: enable solib profiling with -pg and gprof with GLIBC >= 2.37.
However such profiling requires https://sourceware.org/bugzilla/show_bug.cgi?id=29438 to be fixed.
2022-08-07 11:56:23 +03:00
Леонид Юрьев (Leonid Yuriev)
d28110373e mdbx: add simple SORT_CMP_SWAP() macro for MDBX_HAVE_CMOV=0 case. 2022-08-07 11:56:23 +03:00
Леонид Юрьев (Leonid Yuriev)
480dc2531e mdbx: ×4 accelerated scan4seq() (SSE2 only for now). 2022-08-07 11:56:23 +03:00
Леонид Юрьев (Leonid Yuriev)
06734bf8ff mdbx: don't check owner for finished transactions. 2022-08-06 13:19:49 +03:00
Леонид Юрьев (Leonid Yuriev)
c37fb50532 mdbx: more for __amd64__ macro. 2022-08-04 13:54:07 +03:00
Леонид Юрьев (Leonid Yuriev)
9eb6953778 mdbx: fix minor typo. 2022-08-04 13:54:07 +03:00
Леонид Юрьев (Leonid Yuriev)
268b33cbf7 mdbx: simplify/speedup scan4seq(). 2022-08-04 13:54:07 +03:00
Леонид Юрьев (Leonid Yuriev)
e444c70cb7
mdbx: release v0.11.9
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) <leo@yuriev.ru>
2022-08-02 12:00:30 +03:00
Леонид Юрьев (Leonid Yuriev)
a441c9ffb1 mdbx: logging pgno of invalid root pages inside meta_checktxnid(). 2022-08-01 14:44:33 +03:00
Леонид Юрьев (Leonid Yuriev)
71c3d20c01 mdbx: skip extra cycle during search of page sequence. 2022-08-01 00:00:14 +03:00
Леонид Юрьев (Leonid Yuriev)
75d19b5806 mdbx: minor refine/speedup pnl_check(). 2022-07-27 21:08:54 +03:00
Леонид Юрьев (Leonid Yuriev)
dc39ecfb9f mdbx: auto-coalesce of GC's records with less overhead. 2022-07-27 21:08:54 +03:00
Леонид Юрьев (Leonid Yuriev)
47d5fa7fd4 mdbx: refine/speedup pnl_merge(). 2022-07-27 21:08:54 +03:00
Леонид Юрьев (Leonid Yuriev)
fe6c6b2068 mdbx: add MDBX_HAVE_CMOV macro/option. 2022-07-27 21:08:54 +03:00
Леонид Юрьев (Leonid Yuriev)
262fafd00e mdbx: fix unused warning for case MDBX_ENABLE_PGOP_STAT=0. 2022-07-27 00:03:27 +03:00
Леонид Юрьев (Leonid Yuriev)
289636834c mdbx: fix unused warning for case MDBX_DISABLE_VALIDATION. 2022-07-27 00:03:27 +03:00
Леонид Юрьев (Leonid Yuriev)
c4dd83fbdf mdbx: minor refine page_split(). 2022-07-27 00:03:22 +03:00
Леонид Юрьев (Leonid Yuriev)
cc51a7f76e mdbx: minor refine attributes-related macros for LCC. 2022-07-23 12:15:55 +03:00
Леонид Юрьев (Leonid Yuriev)
a82f59a998 mdbx: minor refine MDBX_UNALIGNED_OK. 2022-07-23 12:15:19 +03:00
Леонид Юрьев (Leonid Yuriev)
08e936a809 mdbx: re-verify atomic-ops and remove mo_SequentialConsistency. 2022-07-23 12:15:19 +03:00
Леонид Юрьев (Leonid Yuriev)
5e565433f7 mdbx: merge branch master into devel. 2022-07-23 11:56:17 +03:00
Леонид Юрьев (Leonid Yuriev)
e963375302 mdbx: fix unexpected MDBX_PAGE_FULL in rare cases with large page-size. 2022-07-21 17:52:08 +03:00
yperbasis
23e7870e81 #include <AvailabilityMacros.h> 2022-07-19 18:35:19 +02:00
Леонид Юрьев (Leonid Yuriev)
69b495d559 mdbx++: add to mdbx::env overloads with const char* pathname parameter. 2022-07-13 21:45:23 +03:00
Леонид Юрьев (Leonid Yuriev)
0018164fef mdbx: fix wrong } oops-like typo.
This is a `devel`-only 3-days old regression since a4a35ce9cb7176b914e0606d38c6d6e47a9431f1.
2022-07-11 20:29:33 +03:00
Леонид Юрьев (Leonid Yuriev)
5ccfb5f30a mdbx-tools: use MDBX_DBG_DUMP, MDBX_DBG_ASSERT, MDBX_DBG_AUDIT inside mdbx_chk. 2022-07-11 20:28:07 +03:00
Леонид Юрьев (Leonid Yuriev)
149e708830 mdbx: rename MDBX_CACHE_METAPTR build-time option. 2022-07-10 10:05:39 +03:00
Леонид Юрьев (Leonid Yuriev)
194f2f45d2 mdbx: refine/fix using nested cursor's db inside copy-with-compactification. 2022-07-09 18:07:54 +03:00
Леонид Юрьев (Leonid Yuriev)
e8dd208e96 mdbx: more cursor-checking for audit-without-debug. 2022-07-09 16:12:41 +03:00
Леонид Юрьев (Leonid Yuriev)
9108a241a2 mdbx: minor fix/clarify debug logging inside page_alloc_slowpath(). 2022-07-08 23:44:03 +03:00
Леонид Юрьев (Leonid Yuriev)
9aa2aae93e mdbx: rework/simplify kick_longlived_readers(). 2022-07-08 23:44:03 +03:00
Леонид Юрьев (Leonid Yuriev)
9421bb424d mdbx: refine/simplify read-latch loop inside mdbx_txn_renew0().
1. Explicitly check and handle a race/collision case with `find_oldest_reader()`.
2. Handle "recovery mode" (me_stuck_meta >= 0) by the same code as for regular latch.
3. Add bailout error message for buggy compiler and/or hardware (paranoid).
2022-07-08 23:44:03 +03:00
Леонид Юрьев (Leonid Yuriev)
434ad8edc8 mdbx: refine bind_rslot(). 2022-07-08 23:44:03 +03:00
Леонид Юрьев (Leonid Yuriev)
a4a35ce9cb mdbx: rework find_oldest_reader().
1. Fix regression `assert: oldest >= lck->mti_oldest_reader.weak` after d4bf0a3332c7b05331ab0a87e3cd65b0903edc3c.
2. Add explicit check, kick and notice for stuck reader.
3. Made more e2k-frendly.
2022-07-08 23:44:03 +03:00
Леонид Юрьев (Leonid Yuriev)
d572052178 mdbx: refine meta_checktxnid() and meta_waittxnid(). 2022-07-08 23:44:03 +03:00
Леонид Юрьев (Leonid Yuriev)
6f6c581c6e mdbx: minor refine safe64_write(), safe64_read() and safe64_inc(). 2022-07-08 23:44:03 +03:00
Леонид Юрьев (Leonid Yuriev)
baea4c81c9 mdbx: simplify safe64_reset(). 2022-07-08 23:44:03 +03:00
Леонид Юрьев (Leonid Yuriev)
ad5a83586b mdbx: fix insignificant uint8_t-casting warnings. 2022-07-08 23:44:03 +03:00
Леонид Юрьев (Leonid Yuriev)
b5346ee765 mdbx: use unsigned constants for page flags (to avoid MSVC warnings). 2022-07-08 21:48:08 +03:00
Леонид Юрьев (Leonid Yuriev)
db0f4e3d1e mdbx: minor fix mdbx_page_check() for case debug-audit enforced. 2022-07-08 21:45:26 +03:00
Леонид Юрьев (Leonid Yuriev)
c499f2bb36 mdbx: minor fix EINVAL from mdbx_env_set_geometry().
Silently growth `size_lower` to the `MIN_PAGENO` instead of returning `MDBX_EINVAL`.
2022-07-08 01:14:29 +03:00
Леонид Юрьев (Leonid Yuriev)
6e2a1ebfbd mdbx: minor fix meta_checktxnid() to avoid assertion in debug mode. 2022-07-08 01:08:54 +03:00
Леонид Юрьев (Leonid Yuriev)
2cfcfcf91c mdbx: merge branch erigon into devel. 2022-07-07 23:24:45 +03:00
Леонид Юрьев (Leonid Yuriev)
81ea7bd41e mdbx: fix copy&paste typo inside meta_checktxnid(). 2022-07-07 21:48:34 +03:00
Леонид Юрьев (Leonid Yuriev)
f16bee8fa1 mdbx: fix/setup zero mod_txnid during copy-with-compactification. 2022-07-07 21:48:34 +03:00
Леонид Юрьев (Leonid Yuriev)
c95143f41b mdbx: add poor_page(). 2022-07-07 21:48:34 +03:00
Леонид Юрьев (Leonid Yuriev)
19c5e4d424 mdbx-tools: use MDBX_VALIDATION. 2022-07-07 21:48:34 +03:00
Леонид Юрьев (Leonid Yuriev)
6076c510f8 mdbx-tools: refine assertions logging inside mdbx_chk. 2022-07-07 21:48:34 +03:00
Леонид Юрьев (Leonid Yuriev)
bc744a843a mdbx: refine/speedup PAGETYPE(). 2022-07-07 21:48:34 +03:00
Леонид Юрьев (Leonid Yuriev)
a812198c49 mdbx: rework/clone page_get() to three for the cases: any, large, branch-leaf. 2022-07-07 21:48:30 +03:00
Леонид Юрьев (Leonid Yuriev)
fbe97a79a3 mdbx: more checking for a large/overflow nodes and pages. 2022-07-07 21:46:19 +03:00
Леонид Юрьев (Leonid Yuriev)
3cc7f105a5 mdbx: fix copy&paste typo inside meta_checktxnid(). 2022-07-07 19:11:47 +03:00
Леонид Юрьев (Leonid Yuriev)
b31b270ffd mdbx: refine copy-with-compactification to clear/zero unused gaps on a DB pages. 2022-07-07 19:09:52 +03:00
Леонид Юрьев (Leonid Yuriev)
0b5cdee6ef mdbx: fix mdbx_env_compact() hand when DB is corrupted or the volume of an output pages aliquot to MDBX_ENVCOPY_WRITEBUF. 2022-07-07 19:05:35 +03:00
Леонид Юрьев (Leonid Yuriev)
6eefa05f3d mdbx: minor refine CC_RETIRING handling. 2022-07-07 14:10:19 +03:00
Леонид Юрьев (Leonid Yuriev)
ca3f188370 mdbx: extend CHECK_LEAF_TYPE() by adding CC_OVERFLOW. 2022-07-07 14:10:19 +03:00
Леонид Юрьев (Leonid Yuriev)
498514dae1 mdbx: remove unneeded CC_COPYING. 2022-07-07 14:10:19 +03:00
Леонид Юрьев (Leonid Yuriev)
1740f8227a mdbx: rework copy-with-compactification.
Кроме небольшого рефакторинга здесь реализуется более регулярный способ
обхода дерева при копировании с компактификаций. В частности, полная
инициализация курсоров позволяет выполнять больше проверок/контроля
структуры БД и избавиться от флажка CC_COPYING.

Beside a small refactoring, a more regular way of traversing the tree
when copying with compactification is implemented here. In particular,
full initialization of cursors allows to perform more checks/control of
the DB structure and get rid of the CC_COPYING flag.
2022-07-07 14:10:19 +03:00
Леонид Юрьев (Leonid Yuriev)
2d300d807b mdbx: extract node_read_bigdata(). 2022-07-07 14:10:19 +03:00
Леонид Юрьев (Leonid Yuriev)
d4ef9bf233 mdbx: rework page validation/checking, add MDBX_VALIDATION option (squashed).
Здесь основная часть изменений преобразующих отладочную проверку страниц
в регулярный и доступный пользователю осторожный/безопасный режим работы
с потенциально поврежденной БД.

Here the major part of the changes that transform a debugging check of
pages into a regular and user-accessible careful/safe mode for working
with a potentially corrupted database.
2022-07-07 14:10:09 +03:00
Леонид Юрьев (Leonid Yuriev)
6c5ff863ff mdbx: remove pp_txnid4chk(), preparing to rework of page checking/validation. 2022-07-05 15:32:09 +03:00
Леонид Юрьев (Leonid Yuriev)
d61c096313 mdbx: drop mdbx_recent_steady_txnid() and fix extra search for steady meta-page. 2022-07-02 22:53:48 +03:00
Леонид Юрьев (Leonid Yuriev)
b9835389f4 mdbx: add cache for pointers to last/steady meta-pages (off by default). 2022-07-02 22:52:31 +03:00
Леонид Юрьев (Leonid Yuriev)
720b4d56be mdbx: bigfoot feature.
Chunking long list of retired pages during huge transactions commit
to avoid use sequences of pages:
 - splits a long retired page-number-list into chunks
   which fits one per single overflow/large page;
 - this requires a few unique id for keys
   for create such records into GC/freeDB;
 - just use the necessary subsequent IDs following the current
   transaction ID and then take the last of ones to update a meta-page.

Thus avoids using/allocating/searching a sequence of free pages
but just increase txnid more than one during the commit
a huge write transaction with a long retired-pages-list.
2022-07-02 22:33:25 +03:00
Леонид Юрьев (Leonid Yuriev)
4f6b92248d mdbx: add pgop_stat.gcrtime for collect the time spent loading and searching inside GC. 2022-07-01 09:27:38 +03:00
Леонид Юрьев (Leonid Yuriev)
48c6051482 mdbx: minor fix meta_checktxnid() to avoid assertion in debug mode. 2022-06-29 13:37:26 +03:00
Леонид Юрьев (Leonid Yuriev)
23bbceb367 mdbx: minor fix EINVAL from mdbx_env_set_geometry().
Silently growth `size_lower` to the `MIN_PAGENO` instead of returning `MDBX_EINVAL`.
2022-06-27 13:55:44 +03:00
Леонид Юрьев (Leonid Yuriev)
065e5849da mdbx: speedup GC-related pnl-merge and sequence-search. 2022-06-27 12:37:29 +03:00
Леонид Юрьев (Leonid Yuriev)
e3a09db3da mdbx: always coalescing GC records, regardless to MDBX_COALESCE flag. 2022-06-27 12:37:29 +03:00
Леонид Юрьев (Leonid Yuriev)
ece2fe2514 mdbx: split page_alloc() and page_new() to fast- and slow/rare- parts. 2022-06-27 12:37:29 +03:00
Леонид Юрьев (Leonid Yuriev)
f1ccc717b4 mdbx: add update-gc context (extracted from bigfoot). 2022-06-27 11:27:05 +03:00
Леонид Юрьев (Leonid Yuriev)
f5280ebf6e mdbx: bump version to 0.12.0 (not a release but preparation for changing feature set and API). 2022-06-25 15:14:46 +03:00
Леонид Юрьев (Leonid Yuriev)
bd80e01eda
mdbx: release v0.11.8
The stable release with an important fixes and workaround for the critical macOS thread-local-storage issue.

Acknowledgements:
-----------------

 - [Masatoshi Fukunaga](https://github.com/mah0x211) for [Lua bindings](https://github.com/mah0x211/lua-libmdbx).

New:
----

 - Added most of transactions flags to the public API.
 - Added `MDBX_NOSUCCESS_EMPTY_COMMIT` build option to return non-success result (`MDBX_RESULT_TRUE`) on empty commit.
 - Reworked validation and import of DBI-handles into a transaction.
   Assumes  these changes will be invisible to most users, but will cause fewer surprises in complex DBI cases.
 - Added ability to open DB in without-LCK (exclusive read-only) mode in case no permissions to create/write LCK-file.

Fixes:
------

 - A series of fixes and improvements for automatically generated documentation (Doxygen).
 - Fixed copy&paste bug with could lead to `SIGSEGV` (nullptr dereference) in the exclusive/no-lck mode.
 - Fixed minor warnings from modern Apple's CLANG 13.
 - Fixed minor warnings from CLANG 14 and in-development CLANG 15.
 - Fixed `SIGSEGV` regression in without-LCK (exclusive read-only) mode.
 - Fixed `mdbx_check_fs_local()` for CDROM case on Windows.
 - Fixed nasty typo of typename which caused false `MDBX_CORRUPTED` error in a rare execution path,
   when the size of the thread-ID type not equal to 8.
 - Fixed write-after-free memory corruption on latest `macOS` during finalization/cleanup of thread(s) that executed read transaction(s).
   > The issue was suddenly discovered by a [CI](https://en.wikipedia.org/wiki/Continuous_integration)
   > after adding an iteration with macOS 11 "Big Sur", and then reproduced on recent release of macOS 12 "Monterey".
   > The issue was never noticed nor reported on macOS 10 "Catalina" nor others.
   > Analysis shown that the problem caused by a change in the behavior of the system library (internals of dyld and pthread)
   > during thread finalization/cleanup: now a memory allocated for a `__thread` variable(s) is released
   > before execution of the registered Thread-Local-Storage destructor(s),
   > thus a TLS-destructor will write-after-free just by legitime dereference any `__thread` variable.
   > This is unexpected crazy-like behavior since the order of resources releasing/destroying
   > is not the reverse of ones acquiring/construction order. Nonetheless such surprise
   > is now workarounded by using atomic compare-and-swap operations on a 64-bit signatures/cookies.
 - Fixed Elbrus/E2K LCC 1.26 compiler warnings (memory model for atomic operations, etc).

Minors:
-------

 - Refined `release-assets` GNU Make target.
 - Added logging to `mdbx_fetch_sdb()` to help debugging complex DBI-handels use cases.
 - Added explicit error message from probe of no-support for `std::filesystem`.
 - Added contributors "score" table by `git fame` to generated docs.
 - Added `mdbx_assert_fail()` to public API (mostly for backtracing).
 - Now C++20 concepts used/enabled only when `__cpp_lib_concepts >= 202002`.
 - Don't provide nor report package information if used as a CMake subproject.

Signed-off-by: Леонид Юрьев (Leonid Yuriev) <leo@yuriev.ru>
2022-06-12 23:47:18 +03:00
Леонид Юрьев (Leonid Yuriev)
3817236b68 mdbx: avoid memory-model from variables for C11 atomics (workaround for lcc 1.26). 2022-06-12 20:04:35 +03:00
Леонид Юрьев (Leonid Yuriev)
c082eb7d8a mdbx: use _tlv_atexit() on Darwin/MacOSX. 2022-06-11 21:16:29 +03:00
Леонид Юрьев (Leonid Yuriev)
abac366eac mdbx: rework/fix rthc-cleanup using pthread' tsd to avoid write-after-free (critical). 2022-06-11 21:16:29 +03:00
Леонид Юрьев (Leonid Yuriev)
63f8eb253d mdbx: do not enable ASAN.detect_leaks in macOS since unsupported. 2022-06-10 17:26:10 +03:00
Леонид Юрьев (Leonid Yuriev)
117be44c44 mdbx: fix nasty typename typo.
Спасибо Станиславу Очеретному за сообщение о проблеме.
2022-06-08 20:57:42 +03:00
Леонид Юрьев (Leonid Yuriev)
cdb16c9f00 mdbx: minor fix/clarify internal comment. 2022-06-07 18:13:49 +03:00
Леонид Юрьев (Leonid Yuriev)
77f56541d0 mdbx-windows: refine/fix mdbx_check_fs_local() for CDROM case. 2022-06-04 02:08:24 +03:00
Леонид Юрьев (Leonid Yuriev)
73fbf5c8fa mdbx: fix minor typo in comment. 2022-06-04 02:07:19 +03:00
Леонид Юрьев (Leonid Yuriev)
d1e67645a2 mdbx: refine handling EACCESS while trying create LCK-file on a read-only filesystem. 2022-06-04 02:04:55 +03:00
Леонид Юрьев (Leonid Yuriev)
a4da10bc62 mdbx: minor fix LCK-initialization. 2022-06-03 22:40:18 +03:00
Леонид Юрьев (Leonid Yuriev)
e795fe7c3e mdbx: fix without-LCK (exclusive + readonly) mode. 2022-06-03 22:39:11 +03:00
Леонид Юрьев (Leonid Yuriev)
b6138c39f0 mdbx: reorganize internal includes. 2022-06-02 20:35:40 +03:00
Леонид Юрьев (Leonid Yuriev)
535ad41ae6 mdbx: made internal noop macro compatible with MSVC. 2022-06-02 20:35:40 +03:00
Леонид Юрьев (Leonid Yuriev)
106f39327e mdbx: add mdbx_assert_fail() to public API. 2022-06-02 20:35:40 +03:00
Леонид Юрьев (Leonid Yuriev)
501691a3c0 mdbx: add __assert_fail() macro for Android. 2022-06-02 20:35:40 +03:00
Леонид Юрьев (Leonid Yuriev)
d9407ee648 mdbx: minor refine page_alloc() internal logging. 2022-05-31 17:48:23 +03:00
Леонид Юрьев (Leonid Yuriev)
c7bde8be8d mdbx: rework internal DBI-handles serials, validation and import into a txn (squashed). 2022-05-31 17:48:10 +03:00
Леонид Юрьев (Leonid Yuriev)
70d9efdce4 mdbx: fix minor CLANG 14/15 warnings. 2022-05-17 13:36:38 +03:00
Леонид Юрьев (Leonid Yuriev)
21e1dc3248 mdbx: fix minor warnings from modern Apple's CLANG. 2022-05-15 23:42:57 +03:00
Леонид Юрьев (Leonid Yuriev)
5cd4190f2d mdbx: fix copy&paste bug.
Resolves https://gitflic.ru/project/erthink/libmdbx/issue/5
2022-05-12 14:21:19 +03:00
Леонид Юрьев (Leonid Yuriev)
405de05ca9 mdbx: return MDBX_RESULT_TRUE on empty transaction commit. 2022-05-12 13:11:59 +03:00
Леонид Юрьев (Leonid Yuriev)
548d0a50b8 mdbx: minor refine logging inside page_alloc(). 2022-05-04 19:07:33 +03:00
Леонид Юрьев (Leonid Yuriev)
f57ca4fbf6 mdbx: minor refine logging inside fetch_sdb(). 2022-05-04 18:00:54 +03:00
Леонид Юрьев (Leonid Yuriev)
9230201ca9 mdbx: fix minor warning for MDBX_TXN_INVALID. 2022-05-03 14:16:19 +03:00
Леонид Юрьев (Leonid Yuriev)
6e4094c714 mdbx-docs: refine Build options for Doxygen. 2022-05-03 12:05:16 +03:00
Леонид Юрьев (Leonid Yuriev)
838f8d8fab mdbx: move most of transactions flags to public API. 2022-05-03 11:49:28 +03:00
Леонид Юрьев (Leonid Yuriev)
447d6bfca5 mdbx: add logging to mdbx_fetch_sdb() to help users debugging complex DBI use cases. 2022-05-01 12:02:40 +03:00
Леонид Юрьев (Leonid Yuriev)
40ec559c8c
mdbx: release v0.11.7
The stable risen release after the Github's intentional malicious disaster.

We have migrated to a reliable trusted infrastructure
-----------------------------------------------------

The origin for now is at [GitFlic](https://gitflic.ru/project/erthink/libmdbx)
since on 2022-04-15 the Github administration, without any warning nor
explanation, deleted _libmdbx_ along with a lot of other projects,
simultaneously blocking access for many developers.
For the same reason ~~Github~~ is blacklisted forever.

GitFlic already support Russian and English languages, plan to support more,
including 和 中文. You are welcome!

New:
----

 - Added the `tools-static` make target to build statically linked MDBX tools.
 - Support for Microsoft Visual Studio 2022.
 - Support build by MinGW' make from command line without CMake.
 - Added `mdbx::filesystem` C++ API namespace that corresponds to `std::filesystem` or `std::experimental::filesystem`.
 - Created [website](https://libmdbx.website.yandexcloud.net/) for online auto-generated documentation.
 - Used `todo4recovery://erased_by_github/` for dead (or temporarily lost) resources deleted by ~~Github~~.
 - Added `--loglevel=` command-line option to the `mdbx_test` tool.
 - Added few fast smoke-like tests into CMake builds.

Fixes:
------

 - Fixed a race between starting a transaction and creating a DBI descriptor that could lead to `SIGSEGV` in the cursor tracking code.
 - Clarified description of `MDBX_EPERM` error returned from `mdbx_env_set_geometry()`.
 - Fixed non-promoting the parent transaction to be dirty in case the undo of the geometry update failed during abortion of a nested transaction.
 - Resolved linking issues with `libstdc++fs`/`libc++fs`/`libc++experimental` for C++ `std::filesystem` or `std::experimental::filesystem` for legacy compilers.
 - Added workaround for GNU Make 3.81 and earlier.
 - Added workaround for Elbrus/LCC 1.25 compiler bug of class inline `static constexpr` member field.
 - [Fixed](https://github.com/ledgerwatch/erigon/issues/3874) minor assertion regression (only debug builds were affected).
 - Fixed detection of `C++20` concepts accessibility.
 - Fixed detection of Clang's LTO availability for Android.
 - Fixed build for ARM/ARM64 by MSVC.
 - Fixed non-x86 Windows builds with `MDBX_WITHOUT_MSVC_CRT=ON` and `MDBX_BUILD_SHARED_LIBRARY=ON`.

Minors:
-------

 - Resolve minor MSVC warnings: avoid `/INCREMENTAL[:YES]` with `/LTCG`, `/W4` with `/W3`, the `C5105` warning.
 - Switched to using `MDBX_EPERM` instead of `MDBX_RESULT_TRUE' to indicate that the geometry cannot be updated.
 - Added `NULL` checking during memory allocation inside `mdbx_chk`.
 - Resolved all warnings from MinGW while used without CMake.
 - Added inheretable `target_include_directories()` to `CMakeLists.txt` for easy integration.
 - Added build-time checks and paranoid runtime assertions for the `off_t` arguments of `fcntl()` which are used for locking.
 - Added `-Wno-lto-type-mismatch` to avoid false-positive warnings from old GCC during LTO-enabled builds.
 - Added checking for TID (system thread id) to avoid hang on 32-bit Bionic/Android  within `pthread_mutex_lock()`.
 - Reworked `MDBX_BUILD_TARGET` of CMake builds.
 - Added `CMAKE_HOST_ARCH` and `CMAKE_HOST_CAN_RUN_EXECUTABLES_BUILT_FOR_TARGET`.

Signed-off-by: Леонид Юрьев (Leonid Yuriev) <leo@yuriev.ru>
2022-04-22 23:28:56 +03:00
Леонид Юрьев (Leonid Yuriev)
f341129afa mdbx-windows: fix for non-x86 with MDBX_WITHOUT_MSVC_CRT=ON and MDBX_BUILD_SHARED_LIBRARY=ON. 2022-04-22 18:31:49 +03:00
Леонид Юрьев (Leonid Yuriev)
1ec5687d36 mdbx: fix build for ARM/ARM64 by MSVC. 2022-04-22 17:18:58 +03:00
Леонид Юрьев (Leonid Yuriev)
bb377fd20e mdbx: merge branch master into devel. 2022-04-21 15:44:23 +03:00
Леонид Юрьев (Leonid Yuriev)
a2aa6667e1 mdbx: avoid 32-bit Bionic/Android hang within pthread_mutex_lock(). 2022-04-21 15:41:25 +03:00
Леонид Юрьев (Leonid Yuriev)
6d15836171 mdbx: use todo4recovery://erased_by_github/ for dead (or temporarily lost) resources. 2022-04-21 15:34:53 +03:00
Леонид Юрьев (Leonid Yuriev)
ed23956e11 mdbx: basic cleanup from dead github and another corrupted services. 2022-04-20 06:42:16 +03:00
Леонид Юрьев (Leonid Yuriev)
eb8bc865d1 mdbx: fix and check width of off_t for Android. 2022-04-19 20:00:29 +03:00
Леонид Юрьев (Leonid Yuriev)
4628ac6863 mdbx: add paranoid assertions for off_t args of fcntl(). 2022-04-19 19:43:42 +03:00
Леонид Юрьев (Leonid Yuriev)
9fa4e21165 mdbx: fix assertion regression.
Fixes https://github.com/ledgerwatch/erigon/issues/3874.

This was a minor regression after the c4a5325aafd3f03ce7520731b9da7253d7d178f0
that affects only debug builgs (with enabled assertions) and only when the added
code catch a incoherency of unified page/buffer cache.
2022-04-11 21:52:46 +03:00
Леонид Юрьев (Leonid Yuriev)
7b95720f59 mdbx++: add support for legacy experimental/filesystem. 2022-04-05 22:20:39 +03:00
Леонид Юрьев (Leonid Yuriev)
6f37c8e57f mdbx: resolve all warnings from MinGW. 2022-03-30 18:13:08 +03:00
Leonid Yuriev
21da42d23d mdbx: fix built-in status of MDBX_WITHOUT_MSVC_CRT option. 2022-03-30 18:10:03 +03:00
Леонид Юрьев (Leonid Yuriev)
2497437060 mdbx: mark the parent transaction dirty in case the undo of the geometry update failed during abortion of a nested transaction. 2022-03-29 18:57:35 +03:00
Леонид Юрьев (Leonid Yuriev)
33a9395afe mdbx: use MDBX_EPERM to indicate that the geometry cannot be updated instead of `MDBX_RESULT_TRUE'. 2022-03-29 18:57:26 +03:00
Leonid Yuriev
27a513682a mdbx: disable C5105 warning for Visual Studio > 15.7 (MSVC > 19.14). 2022-03-28 23:57:24 +03:00
Леонид Юрьев (Leonid Yuriev)
eb532b8907 mdbx-tools: add check for log-level. 2022-03-28 23:57:24 +03:00
Леонид Юрьев (Leonid Yuriev)
6f06641bf2 mdbx-tools: handle NULL from memory allocation functions. 2022-03-28 23:44:31 +03:00
Леонид Юрьев (Leonid Yuriev)
6380f2e844 mdbx: minor reformat (cosmetics). 2022-03-25 13:47:37 +03:00
Леонид Юрьев (Leonid Yuriev)
fef90d2a3c mdbx: add explicit memset() for debugging. 2022-03-25 13:47:37 +03:00
Леонид Юрьев (Leonid Yuriev)
d522069080 mdbx: fix rare SIGSEGV in cursor tracking code.
The error was that the array of pointers in the transaction zeroed by the
value of env->me_numdbs and before txn->mt_numdbs was set to env->me_numdbs.
Thus, a cursor pointer(s) in the starting transaction could uninitialized if
another thread opened a dbi-handle(s) between the two aforementioned events.
2022-03-25 13:05:46 +03:00
Леонид Юрьев (Leonid Yuriev)
d5e4c198d8
mdbx: release v0.11.6
The stable release with the complete workaround for an incoherence flaw of Linux unified page/buffer cache.
Nonetheless the cause for this trouble may be an issue of Intel CPU cache/MESI.
See [issue#269](https://github.com/erthink/libmdbx/issues/269) for more information.

Acknowledgements:
-----------------

 - [David Bouyssié](https://github.com/david-bouyssie) for [Scala bindings](https://github.com/david-bouyssie/mdbx4s).
 - [Michelangelo Riccobene](https://github.com/mriccobene) for reporting and testing.

Fixes:
------

 - [Added complete workaround](https://github.com/erthink/libmdbx/issues/269) for an incoherence flaw of Linux unified page/buffer cache.
 - [Fixed](https://github.com/erthink/libmdbx/issues/272) cursor reusing for read-only transactions.
 - Fixed copy&paste typo inside `mdbx::cursor::find_multivalue()`.

Minors:
-------

 - Minor refine C++ API for convenience.
 - Minor internals refines.
 - Added `lib-static` and `lib-shared` targets for make.
 - Added minor workaround for AppleClang 13.3 bug.
 - Clarified error messages of a signature/version mismatch.

Signed-off-by: Леонид Юрьев (Leonid Yuriev) <leo@yuriev.ru>
2022-03-24 20:44:21 +03:00
Леонид Юрьев (Leonid Yuriev)
43070c7b26 mdbx: minor fix meta_checktxnid() for Valgrind/ASAN usage.
Related to https://github.com/erthink/libmdbx/issues/269.
2022-03-24 12:11:50 +03:00
Леонид Юрьев (Leonid Yuriev)
45f8197635 mdbx: clarify/refine error messages of a signature/version mismatch. 2022-03-24 00:19:34 +03:00
Леонид Юрьев (Leonid Yuriev)
b79f6712e3 mdbx: refine override_meta() to preserve format-signature for legacy/zero mod_txnid. 2022-03-23 00:48:41 +03:00
Леонид Юрьев (Leonid Yuriev)
de63041b7d mdbx: add MDBX_DBG_DONT_UPGRADE flag. 2022-03-23 00:48:41 +03:00
Леонид Юрьев (Leonid Yuriev)
a5c064c33e mdbx: preserve (don't upgrade) format-signature during turn to a specified meta-page while recovery. 2022-03-23 00:48:41 +03:00
Your Name
9c832c24a6 mdbx: minor fix error-message space. 2022-03-23 00:48:41 +03:00
Леонид Юрьев (Leonid Yuriev)
c4a5325aaf mdbx: check-and-retry against page arrival as a workaround for unified page/buffer cache incoherency.
Part 2 of 2 of the workaround for https://github.com/erthink/libmdbx/issues/269.
2022-03-08 17:09:29 +03:00
Леонид Юрьев (Leonid Yuriev)
93cf99a07c mdbx: drop the previous temporary workaround for unified page/buffer cache incoherency.
Related to https://github.com/erthink/libmdbx/issues/269.
2022-03-06 13:22:57 +03:00
Леонид Юрьев (Leonid Yuriev)
00ed61c685 mdbx: check-and-retry a mvcc-snapshot for unified page/buffer cache coherency.
Part 1 of 2 of the workaround for https://github.com/erthink/libmdbx/issues/269.
2022-03-06 13:22:38 +03:00
Леонид Юрьев (Leonid Yuriev)
9d8fc7b984 mdbx: minor mix result caching inside the get_reasonable_db_maxsize().
Change-Id: I9763ebb323d4f66e702e07f708e269e2479880ac
2022-03-05 14:31:02 +03:00
Леонид Юрьев (Leonid Yuriev)
44fb240955 mdbx: merge branch issue-269 into the devel branch. 2022-03-04 17:46:43 +03:00
Леонид Юрьев (Leonid Yuriev)
bfea3ca9fb mdbx: minor refine mdbx_page_search() internals. 2022-03-04 17:38:25 +03:00
Леонид Юрьев (Leonid Yuriev)
7ade182d64 mdbx: minor simplify/refine mdbx_env_set_geometry() internals. 2022-03-04 17:38:25 +03:00
Леонид Юрьев (Leonid Yuriev)
4adc7aa58d mdbx: add few checks to mdbx_validate_meta(). 2022-03-04 11:53:14 +03:00
Леонид Юрьев (Leonid Yuriev)
110cf09cf8 mdbx: simplify core-dbs update inside mdbx_txn_commit_ex(). 2022-03-04 11:49:54 +03:00
Леонид Юрьев (Leonid Yuriev)
fb25648b9c mdbx: force mdbx_page_get() to inline. 2022-03-04 11:49:01 +03:00
Леонид Юрьев (Leonid Yuriev)
78170a5750 mdbx: minor reduce/lowering debug "update oldest" logging. 2022-03-04 11:41:17 +03:00
Леонид Юрьев (Leonid Yuriev)
71d07b3a8e mdbx: adding cursors tracking/lists for read-only transactions.
Briefly, this commit fixes a missed flaw:
 - Cursor tracking is required to replacing shaded pages and adjusting the positions in writing transactions;
 - Thus, historically, an internal linked list was maintained for a read-write transactions, but not for a read-only.
   For this reason, the API for using cursors should be different for writing and reading transactions;
 - However, the libmdbx's API has been significantly improved, including the ability to reuse cursors and a uniform cursors behavior for any kind of transactions.
   My mistake is that due to working with MithrilDB, I forgot to make a same changes to libmdbx.

Fixes https://github.com/erthink/libmdbx/issues/272.
2022-03-03 15:00:28 +03:00
Леонид Юрьев (Leonid Yuriev)
96c93ac2f1 mdbx++: refine mdbx::env::operate_parameters() and related. 2022-03-03 14:13:10 +03:00
Леонид Юрьев (Leonid Yuriev)
6d61b18325 mdbx: fix auxiliary mdbx_txn_valgrind().
Fixed https://github.com/erthink/libmdbx/issues/273.
2022-02-27 15:42:48 +03:00
Леонид Юрьев (Leonid Yuriev)
d01e44db0c
mdbx: release v0.11.5
The stable release with the hotfix/workaround for a flaw of Linux 4.19 (at least) unified page/buffer cache.
See [issue#269](https://github.com/erthink/libmdbx/issues/269) for more information.

Acknowledgements:
-----------------

 - [Simon Leier](https://github.com/leisim) for reporting and testing.
 - [Kai Wetlesen](https://github.com/kaiwetlesen) for [RPMs](http://copr.fedorainfracloud.org/coprs/kwetlesen/libmdbx/).
 - [Tullio Canepa](https://github.com/canepat) for reporting C++ API issue and contributing.

Fixes:
------

 - [Added workaround](https://github.com/erthink/libmdbx/issues/269) for a flaw of Linux 4.19 (at least) unified page/buffer cache.
 - [Fixed/Reworked](https://github.com/erthink/libmdbx/pull/270) move-assignment operators for "managed" classes of C++ API.
 - Fixed potential `SIGSEGV` while open DB with overrided non-default page size.
 - [Made](https://github.com/erthink/libmdbx/issues/267) `mdbx_env_open()` idempotence in failure cases.
 - Refined/Fixed pages reservation inside `mdbx_update_gc()` to avoid non-reclamation in a rare cases.
 - Fixed typo in a retained space calculation for the hsr-callback.

Minors:
-------

 - Reworked functions for meta-pages, split-off non-volatile.
 - Disentangled C11-atomic fences/barriers and pure-functions (with `__attribute__((__pure__))`) to avoid compiler misoptimization.
 - Fixed hypotetic unaligned access to 64-bit dwords on ARM with `__ARM_FEATURE_UNALIGNED` defined.
 - Reasonable paranoia that makes clarity for code readers.
 - Minor fixes Doxygen references, comments, descriptions, etc.

Signed-off-by: Леонид Юрьев (Leonid Yuriev) <leo@yuriev.ru>
2022-02-23 20:06:30 +03:00
Леонид Юрьев (Leonid Yuriev)
6b45498985 mdbx: temporary workaround/hotfix for a flaw of Linux 4.19 (at least) unified page/buffer cache.
Temporary workaround for https://github.com/erthink/libmdbx/issues/269.
2022-02-22 23:58:57 +03:00
Леонид Юрьев (Leonid Yuriev)
77f236db2a mdbx: clarify loglevel descriptions. 2022-02-17 02:30:16 +03:00
Леонид Юрьев (Leonid Yuriev)
a0728023cd mdbx: fix typo in a retained space calculation for the hsr-callback. 2022-02-16 15:44:06 +03:00
Леонид Юрьев (Leonid Yuriev)
3705d705d3 mdbx: refine/fix pages reserving inside mdbx_updage_gc() to avoid non-reclamation in a rare cases. 2022-02-16 12:18:53 +03:00
Леонид Юрьев (Leonid Yuriev)
72bc655ece mdbx++: fix env::is_empty() to check leaf-pages instead of branch ones.
Seems like an auto-completion mistake.
Thanks to https://igor@t.me/libmdbx for reporing.
2022-02-15 18:11:31 +03:00
Леонид Юрьев (Leonid Yuriev)
c5f1f73fca mdbx: avoid extra looping inside mdbx_page_alloc() for mdbx_prep_backlog(). 2022-02-15 03:17:05 +03:00
Леонид Юрьев (Leonid Yuriev)
925a673d57 mdbx: make mdbx_env_open() idempotence in failure cases.
Fixes https://github.com/erthink/libmdbx/issues/267.
2022-02-13 20:30:57 +03:00
Леонид Юрьев (Leonid Yuriev)
c27787eb31 mdbx: fix potential SIGSEGV for DB with non-default page size.
Related to https://github.com/erthink/libmdbx/issues/267.
2022-02-13 17:04:10 +03:00
Леонид Юрьев (Leonid Yuriev)
2b6fd968d2 mdbx: rework functions for meta-pages, split-off non-volatile, more const. 2022-02-09 22:56:29 +03:00
Леонид Юрьев (Leonid Yuriev)
ef7b4289c0 mdbx: rework unaligned access.
The three points:
 - disentangle C11-atomic fences/barriers and pure-functions (with `__attribute__((__pure__))`) to avoid compiler misoptimization;
 - fix hypotetic unaligned access to 64-bit dwords on ARM with `__ARM_FEATURE_UNALIGNED` defined;
 - reasonable paranoia that makes clarity for code readers.
2022-02-09 22:56:28 +03:00
Леонид Юрьев (Leonid Yuriev)
daa7f04f61
mdbx: release v0.11.4
The stable release with fixes for large and huge databases sized of 4..128 TiB.

Acknowledgements:
-----------------

 - Ledgerwatch, Binance and Positive Technologies teams for reporting, assistance in investigation and testing.
 - Alex Sharov for reporting, testing and provide resources for remote debugging/investigation.
 - Kris Zyp for Deno support.

New features, extensions and improvements:
------------------------------------------

 - Added treating the `UINT64_MAX` value as maximum for given option inside `mdbx_env_set_option()`.
 - Added `to_hex/to_base58/to_base64::output(std::ostream&)` overloads without using temporary string objects as buffers.
 - Added `--geometry-jitter=YES|no` option to the test framework.
 - Added support for [Deno](https://deno.land/) support by [Kris Zyp](https://github.com/kriszyp).

Fixes:
------

 - Fixed handling `MDBX_opt_rp_augment_limit` for GC's records from huge transactions (Erigon/Akula/Ethereum).
 - [Fixed](https://github.com/erthink/libmdbx/issues/258) build on Android (avoid including `sys/sem.h`).
 - [Fixed](https://github.com/erthink/libmdbx/pull/261) missing copy assignment operator for `mdbx::move_result`.
 - Fixed missing `&` for `std::ostream &operator<<()` overloads.
 - Fixed unexpected `EXDEV` (Cross-device link) error from `mdbx_env_copy()`.
 - Fixed base64 encoding/decoding bugs in auxillary C++ API.
 - Fixed overflow of `pgno_t` during checking PNL on 64-bit platforms.
 - [Fixed](https://github.com/erthink/libmdbx/issues/260) excessive PNL checking after sort for spilling.
 - Reworked checking `MAX_PAGENO` and DB upper-size geometry limit.
 - [Fixed](https://github.com/erthink/libmdbx/issues/265) build for some combinations of versions of  MSVC and Windows SDK.

Minors:
-------

 - Added workaround for CLANG bug [D79919/PR42445](https://reviews.llvm.org/D79919).
 - Fixed build test on Android (using `pthread_barrier_t` stub).
 - Disabled C++20 concepts for CLANG < 14 on Android.
 - Fixed minor `unused parameter` warning.
 - Added CI for Android.
 - Refine/cleanup internal logging.
 - Refined line splitting inside hex/base58/base64 encoding to avoid `\n` at the end.
 - Added workaround for modern libstdc++ with CLANG < 4.x
 - Relaxed txn-check rules for auxiliary functions.
 - Clarified a comments and descriptions, etc.
 - Using the `-fno-semantic interposition` option to reduce the overhead to calling self own public functions.

Signed-off-by: Леонид Юрьев (Leonid Yuriev) <leo@yuriev.ru>
2022-02-02 20:56:28 +03:00
Leonid Yuriev
5aeb7ccf25 mdbx: fix extra casting inside mdbx_limits_dbsize_max(). 2022-02-02 14:09:03 +03:00
Leonid Yuriev
79e1cc3bbc mdbx: add workaround for old MSVC and/or old Windows SDK.
Resolves https://github.com/erthink/libmdbx/issues/265.

Change-Id: I295b5d9d5ecd670ccf258791bf87379a3ca17f21
2022-02-01 13:28:59 +03:00
Leonid Yuriev
bd51e181fb mdbx: refine comment for mdbx_update_gc(). 2022-01-31 21:36:57 +03:00
Леонид Юрьев (Leonid Yuriev)
d93a13294a mdbx: explicit disable -Wattributes by #pragma for GCC < 9. 2022-01-27 17:20:12 +03:00
Leonid Yuriev
fe5199b9d1 mdbx: fix/rework PNL checking during search, refine/simplify spilled pages search.
Fixes https://github.com/erthink/libmdbx/issues/260.

Change-Id: I8824f6af2f770c46668ee577aeeeb93b30b17a13
2022-01-26 13:21:21 +03:00
Leonid Yuriev
9ae56332d7 mdbx: fix Coverity warnings. 2022-01-22 18:01:31 +03:00
Leonid Yuriev
03d828834b mdbx: schedule the release of v0.11.4 for 2022-01-28. 2022-01-21 15:43:17 +03:00
Leonid Yuriev
cd2c5f594c mdbx: rework checking MAX_PAGENO and DB upper-size limit.
Related to https://github.com/erthink/libmdbx/issues/260.
2022-01-21 02:25:27 +03:00
Leonid Yuriev
ddef217047 mdbx: relax txn-check rules for auxiliary functions. 2022-01-21 02:13:48 +03:00
Leonid Yuriev
3e28cc2a25 mdbx: allow mdbx_dbi_flags_ex() for errored transactions. 2022-01-21 02:13:48 +03:00
Leonid Yuriev
8779f665dc mdbx: fix excessive PNL checking after sort for spilling.
This bug triggered only in the DEBUG builds or when the assertion checking is forcibly enabled.
It does not affect any core logic and cannot lead to DB corruption, data loss, and so on.

Fixes https://github.com/erthink/libmdbx/issues/260.
2022-01-20 15:25:35 +03:00
Leonid Yuriev
52552ebfe3 mdbx++: fix MSVC warnings/errors. 2022-01-19 21:08:01 +03:00
Leonid Yuriev
a6acc9d1a3 mdbx++: fix minor comment typo.
Change-Id: Ic169523218b366be0688ab92b76c4120df829ba3
2022-01-17 11:06:27 +03:00
Leonid Yuriev
c588af6aca mdbx: update Copyright year.
Change-Id: Ib3e4c0ac94882c4b2a1e167dd98e6e26dbdf48a4
2022-01-17 11:06:14 +03:00
Leonid Yuriev
f2995ac75b mdbx++: add assertions for destination-overflow to from/to hex/base58/base64::write_bytes().
Change-Id: I5a1f23dcb1dc1942f9d72966a78080eacfacf546
2022-01-15 18:52:12 +03:00
Leonid Yuriev
b5b0a9a284 mdbx++: add to_hex/to_base58/to_base64::output(std::ostream&) without using temporary objects/buffers/strings.
Change-Id: Ideffd0e7f450307e14d780dcdeb2458c1c7e4c18
2022-01-15 18:52:12 +03:00
Leonid Yuriev
b139d8165b mdbx++: refine line splitting inside to_hex/to_base58/to_base64 to avoid \n at the end.
Change-Id: I53fb1f31ac5fc41567826a9035b0080fd62c8ade
2022-01-15 18:51:56 +03:00
Leonid Yuriev
ef2e390b10 mdbx++: fix from_base64::write_bytes().
Change-Id: I6c90997bffab45019a77edcf2a9dd35ae80069d3
2022-01-15 18:51:56 +03:00
Leonid Yuriev
51e6d4645c mdbx++: fix to_base64::write_bytes() for tail bytes.
Change-Id: I60defa11b7e44dcf2ac840160ab0c833484c9d39
2022-01-15 17:22:18 +03:00
Leonid Yuriev
2151be6cde mdbx: merge branch 'issue-260' into devel. 2022-01-15 15:31:45 +03:00
Leonid Yuriev
7a06cac680 mdbx: fix unexpected EXDEV (Cross-device link) error from mdbx_env_copy()
Fallback to `write()` if `copy_file_range()` syscall returns `EXDEV`.
2022-01-14 12:39:38 +03:00
Leonid Yuriev
1813bf9e53 mdbx: avoid 32-bit pgno_t overflow during checking PNL on 64-bit platforms.
Related to https://github.com/erthink/libmdbx/issues/260.
2022-01-13 15:42:00 +03:00
Leonid Yuriev
406cafb642 mdbx: treat the UINT64_MAX value as maximum for given option inside mdbx_env_set_option(). 2022-01-06 00:37:08 +03:00
Leonid Yuriev
b19ebf0c2e mdbx: fix minor unused parameter warning. 2022-01-05 17:47:45 +03:00
Leonid Yuriev
066bb696e3 mdbx: avoid including sys/sem.h when MDBX_LOCKING != MDBX_LOCKING_SYSV.
Fixes https://github.com/erthink/libmdbx/issues/258.
2022-01-05 17:47:09 +03:00
Leonid Yuriev
024900ee9c mdbx: fix/refine handling options.rp_augment_limit detent while loading GC records. 2022-01-05 11:03:21 +03:00
Leonid Yuriev
ab83d173ac mdbx: minor refine logging for internal GC-related ops. 2022-01-05 10:50:39 +03:00
Leonid Yuriev
d316bde561 mdbx: minor cleanup comment. 2022-01-05 10:45:23 +03:00
Leonid Yuriev
a6340c6b03 mdbx: minor fix open-MADV logging. 2022-01-05 10:45:15 +03:00
Leonid Yuriev
070ba5ded4 mdbx: check for GCC/clang in debug-includes (insignificant internals). 2022-01-04 13:41:25 +03:00
Leonid Yuriev
6866fa3eaa mdbx: revert returning MDBX_ENODATA from cursor-next. 2021-12-30 22:12:04 +03:00
Leonid Yuriev
9511bc491a mdbx: more unlikely(). 2021-12-30 19:40:22 +03:00
Leonid Yuriev
ae5df65af0 mdbx: refine page_alloc() and update_gc() to reduce looping.
Resolves https://github.com/erthink/libmdbx/issues/254.
2021-12-30 17:36:33 +03:00
Leonid Yuriev
2ba90e63b1 mdbx: remove obsolete current retired-list record from gc before reserve/backlogging free-pages to reduce looping. 2021-12-28 00:10:00 +03:00
Leonid Yuriev
b30ccbde9e mdbx: don't reserve/backlog free-pages if retired-list was already put into gc. 2021-12-28 00:10:00 +03:00
Leonid Yuriev
c3c088b8c3 mdbx: minor unify gc-update debug logging (cosmetics). 2021-12-28 00:10:00 +03:00
Leonid Yuriev
c70d2d62d1 mdbx: fix mdbx_override_meta() to avoid false-positive assertions.
Fixed https://github.com/erthink/libmdbx/issues/253.
2021-12-13 13:03:49 +03:00
Leonid Yuriev
4e44dc69f9 mdbx: add MDBX_SET_UPPERBOUND for cursors.
Resolves https://github.com/erthink/libmdbx/issues/250.
2021-12-13 04:24:34 +03:00
Leonid Yuriev
bee5df20fd mdbx: fix MDBX_SHRINK_ALLOWED collision with MDBX_ACCEDE inside mdbx_env_sync_internal(). 2021-12-13 04:12:43 +03:00
Leonid Yuriev
6f2c1e52ad mdbx: add mdbx_cursor_get_batch().
Resolve https://github.com/erthink/libmdbx/issues/236
2021-12-11 05:58:39 +03:00
Leonid Yuriev
0265c847b8 mdbx++: remove preliminary label from C++ API. 2021-12-09 02:10:08 +03:00
Leonid Yuriev
f4057b2c3b mdbx: avoid extra looping inside mdbx_env_info_ex(). 2021-12-07 01:45:41 +03:00
Leonid Yuriev
839da86cac mdbx: minor fix handling MDBX_SET_LOWERBOUND to avoid MDBX_BAD_VALSIZE.
Related to https://github.com/erthink/libmdbx/issues/248#issuecomment-986542620.
2021-12-07 01:30:43 +03:00
Леонид Юрьев (Leonid Yuriev)
a899056fd1 mdbx: fix extra assertion.
Fixes https://github.com/erthink/libmdbx/issues/248.
2021-12-06 23:28:08 +03:00
Леонид Юрьев (Leonid Yuriev)
c484a92933 mdbx: minor refine prev commit. 2021-12-06 23:00:38 +03:00
Леонид Юрьев (Leonid Yuriev)
da855b13a3 mdbx: rework/simplify mdbx_env_sync_internal(). 2021-12-04 06:56:44 +03:00
Леонид Юрьев (Leonid Yuriev)
8ef8733ddc mdbx: minor refine mdbx_env_set_option(MDBX_opt_sync_bytes). 2021-12-04 06:55:41 +03:00
Leonid Yuriev
4b886e2a58 mdbx: don't return MDBX_RESULT_TRUE (-1) from mdbx_env_set_option(). 2021-12-03 15:33:22 +03:00
Леонид Юрьев (Leonid Yuriev)
d2b15b5958 mdbx: more unlikely(). 2021-12-02 20:22:37 +03:00
Леонид Юрьев (Leonid Yuriev)
d96bc98244 mdbx: minor refine/fix MDBX_ENODATA for compatibility.
Related to https://github.com/erthink/libmdbx/issues/243
2021-12-02 20:22:37 +03:00
Леонид Юрьев (Leonid Yuriev)
c2cab7a6a8 mdbx: using clang-format-13 (cosmetics). 2021-12-02 20:22:31 +03:00
Leonid Yuriev
0cc3aa3af8 mdbx: remove unneeded #undef P_DIRTY. 2021-11-26 17:51:37 +03:00
Leonid Yuriev
adac03729d mdbx: remove unneeded usage of <linux/sysctl.h>.
Fixed https://github.com/erthink/libmdbx/issues/245
2021-11-26 17:34:04 +03:00
Leonid Yuriev
76399bd643 mdbx: fix returning MDBX_NOTFOUND for non-exact seek case of MDBX_GET_BOTH.
Fixed https://github.com/erthink/libmdbx/issues/243
2021-11-25 19:19:04 +03:00
Leonid Yuriev
4f2aba2d22 mdbx: minor fix formatting (cosmetics). 2021-11-25 19:15:02 +03:00
Leonid Yuriev
a2141ceaac mdbx: slightly more cases to return MDBX_ENODATA. 2021-11-22 13:48:08 +03:00
Leonid Yuriev
8cb7c0f4fb mdbx: fix MDBX_PROBLEM while update an obsolete meta-page.
Fixes https://github.com/erthink/libmdbx/issues/242
2021-11-21 02:37:56 +03:00
Леонид Юрьев (Leonid Yuriev)
bfff6cfe85 mdbx: fix nasty sizeof(bytes) typo. 2021-11-19 16:21:44 +03:00
Leonid Yuriev
79a5802ad4 mdbx: add the note about "Visual Studio 2015 Update 3". 2021-11-11 20:38:39 +03:00
Leonid Yuriev
0e2ca3eb51 mdbx: more parallelable CMP2INT for E2K. 2021-11-10 03:17:59 +03:00
Leonid Yuriev
e488604448 mdbx: minor fix mdbx_jitter4testing() for case MDBX_DEBUG >= 2. 2021-11-10 03:05:51 +03:00
Leonid Yuriev
eaa77c91cd mdbx: drop obsolete internal mm_flags macro. 2021-11-10 02:43:43 +03:00
sasgas
74d5a42578 mdbx: fix compilation with devtoolset-9 on CentOS/RHEL 7.
devtoolset is always using the old ABI
https://bugzilla.redhat.com/show_bug.cgi?id=1546704
https://stackoverflow.com/questions/49393888/how-can-i-use-the-new-c-11-abi-with-devtoolset-7-on-centos-rhel
2021-11-09 13:29:23 +03:00
Leonid Yuriev
b46e5c4ce8 mdbx: simplify collection of page-ops statistic. 2021-11-07 22:14:33 +03:00
Leonid Yuriev
96139eef48 mdbx: a whole snapshot inside mdbx_env_info_ex(). 2021-11-07 21:18:10 +03:00
Leonid Yuriev
0c3a5da3cb mdbx: refine visibility of internal mdbx_osal_jitter(). 2021-11-07 19:48:14 +03:00
Leonid Yuriev
93a24abbab mdbx: fix minor/paranoid MSVC warning. 2021-10-24 02:28:28 +03:00
Leonid Yuriev
5babf0872e mdbx++: add ifndef-guard for _CRT_SECURE_NO_WARNINGS. 2021-10-22 20:14:12 +03:00
Leonid Yuriev
331232858a adds updating db-format signature during DB open.
Fixes https://github.com/erthink/libmdbx/issues/238.
2021-10-22 20:13:57 +03:00
Leonid Yuriev
fcb8cd2145
mdbx: alter DB-format' signature and change version to v0.11.x (not a release).
Related to https://github.com/erthink/libmdbx/issues/238

Signed-off-by: Leonid Yuriev <leo@yuriev.ru>
2021-10-21 15:17:18 +03:00
Leonid Yuriev
514910621e mdbx: return MDBX_CORRUPTED instead of MDBX_PAGE_NOTFOUND for invalid pages. 2021-10-15 01:11:20 +03:00
Leonid Yuriev
7251f47d5b mdbx: fix typo which lead any error conversion to the 1. 2021-10-14 20:03:37 +03:00
Leonid Yuriev
4632df5661 mdbx: cleanup non-persistent flags from meta-model. 2021-10-13 16:34:53 +03:00
Leonid Yuriev
11a5c50591 mdbx: fix turn_for_recovery() for possibility of meta-pages clashing after turn to a particular meta-page. 2021-10-13 16:34:53 +03:00
Leonid Yuriev
3092078709 mdbx: refine handling of weak or invalid meta-pages while a DB opening. 2021-10-13 16:34:53 +03:00
Leonid Yuriev
cbb71058ca mdbx: refine providing information for the @MAIN and @GC sub-databases of a last committed modification transaction's ID. 2021-10-13 16:34:25 +03:00
Leonid Yuriev
30745e0621 mdbx: refix #pragma pack for modern compilers and aligned-required arches (hotfix).
Fix a regression after the https://github.com/erthink/libmdbx/issues/235
2021-10-13 16:13:22 +03:00
Leonid Yuriev
64e6fa93fd mdbx: fix #pragma pack to avoid misalignment for some compilers.
Fixes https://github.com/erthink/libmdbx/issues/235.
2021-10-09 12:36:40 +03:00
Leonid Yuriev
fa0a38c1ac mdbx: avoid single-page (too small) shrink threshold by default when MDBX_DEBUG > 0. 2021-10-09 12:30:39 +03:00
Leonid Yuriev
fe0ec8ceca mdbx: fix and refine mdbx_update_gc() to avoid infinite looping possibility (squashed). 2021-10-09 12:29:10 +03:00
Leonid Yuriev
fe7186d549 mdbx: reflow comment (cosmetic). 2021-09-30 16:38:07 +03:00
Leonid Yuriev
d2cba98f70 mdbx: always setup madvise while opening DB.
This partially revert 7da64b725d920b1602ec0d307581a6cdca997d05.

Hope fix https://github.com/erthink/libmdbx/issues/231
2021-08-25 14:13:07 +03:00
Leonid Yuriev
99b75b5004 mdbx: fix/model minor Coverity issues. 2021-08-16 23:45:56 +03:00
Leonid Yuriev
42d545e579 mdbx: fix minor zero-length memcmp() UB. 2021-08-14 17:46:34 +03:00
Leonid Yuriev
b6ffec12e4 "mdbx: ignore legacy P_DIRTY flag (0x10) for nested/sub-pages. 2021-08-11 15:49:46 +03:00
Leonid Yuriev
65fa0cf8ed mdbx++: revive encode/decode to hex/base58/base64 (squashed). 2021-07-26 03:53:11 +03:00
Leonid Yuriev
046dc02f73 mdbx: make MDBX_STRINGIFYmacro public. 2021-07-26 03:53:11 +03:00
Leonid Yuriev
e731260056 mdbx: fix SIGSEGV regression while copying DB with enabled audit. 2021-07-26 02:24:15 +03:00
Leonid Yuriev
7759e52850 mdbx-windows: use MachineGuid of any size for bootid generation. 2021-07-19 12:07:45 +03:00
Leonid Yuriev
e7336e1d5e mdbx: add checks for unexpected LEAF2-pages.
The fourth case of https://github.com/erthink/libmdbx/issues/217.
2021-07-19 12:06:08 +03:00
Leonid Yuriev
68aef96f0a mdbx-tool: minor clarify mdbx_chk' logic key/data checks. 2021-07-19 12:06:08 +03:00
Leonid Yuriev
0b120b8fa9 mdbx-windows: fix bootid generation for case of change system' time. 2021-07-19 12:05:55 +03:00
Leonid Yuriev
28c36af67c mdbx: refine built-in ASAN option. 2021-07-16 16:04:09 +03:00
Leonid Yuriev
d67b9eaf17 mdbx: fix ASAN-regression after 1740043678951c5a1a088e6572722de438162ab2.
Related to https://github.com/erthink/libmdbx/issues/217
2021-07-16 16:03:49 +03:00
Leonid Yuriev
6034985686 mdbx: add MDBX_ASAN_(UN)POISON_MEMORY_REGION() macros. 2021-07-16 16:03:49 +03:00
Leonid Yuriev
7da64b725d mdbx: perform madvise only for the first process opens a DB. 2021-07-16 16:03:49 +03:00
Leonid Yuriev
8aaf5d071b mdbx: fix pagecheck().
Added a check that the data of the BIGDATA node (containing the target page number) is located within the boundaries of the page being checked.

The third case of https://github.com/erthink/libmdbx/issues/217.
2021-07-16 15:55:18 +03:00
Leonid Yuriev
b6233ae2e5 mdbx-tools: minor fix/unify error counters. 2021-07-14 10:29:54 +03:00
Leonid Yuriev
fe5f008d39 mdbx-tools: skip iteration & checking records if corresponding tree is corrupted.
Hope final for https://github.com/erthink/libmdbx/issues/217
2021-07-14 03:59:56 +03:00
Leonid Yuriev
c8743cb9c4 mdbx: fix null-deref while override invalid meta-pages.
Related to https://github.com/erthink/libmdbx/issues/217
2021-07-14 03:59:52 +03:00
Leonid Yuriev
4de2dcebb5 mdbx: increase the MDBX_READERS_LIMIT to 32767.
Fixes https://github.com/erthink/libmdbx/issues/219.
2021-07-11 02:44:19 +03:00
Leonid Yuriev
678a80dd19 mdbx: fix hang/shutdown on big-endian platforms without __cxa_thread_atexit().
Change-Id: I1bf706abaaf42d5b40751d85ed7c7a83d02acaf5
2021-07-11 02:25:39 +03:00
Leonid Yuriev
c18bf4f898 mdbx: minor clarify mdbx_mapresize(). 2021-07-11 02:25:39 +03:00
Leonid Yuriev
728e7f92b2 mdbx: minor fix mdbx_mresize() to preserve result code for read-only cases. 2021-07-11 02:25:39 +03:00
Leonid Yuriev
1740043678 mdbx: minimize the size of poisoned/unpoisoned regions to avoid ASAN hangs.
More for second case of https://github.com/erthink/libmdbx/issues/217
2021-07-11 02:25:26 +03:00
Leonid Yuriev
891d68838a mdbx: return MDBX_TOO_LARGE under Valgrind/ASAN if being opened DB is 100 larger than RAM.
More for second case of https://github.com/erthink/libmdbx/issues/217
2021-07-11 02:25:07 +03:00
Leonid Yuriev
108398c213 mdbx: refine rollback while opening weak/invalid DB.
More for https://github.com/erthink/libmdbx/issues/217
2021-07-11 02:24:51 +03:00
Leonid Yuriev
8bdee27248 mdbx: create/refactoring override_meta(). 2021-07-11 02:24:51 +03:00
Leonid Yuriev
00c6dc9788 mdbx: re-verify head and steady meta-pages while opening db by the first process.
Basic fix for https://github.com/erthink/libmdbx/issues/217
2021-07-11 02:24:06 +03:00
Leonid Yuriev
fb67682a79 mdbx: refine mdbx_validate_meta(). 2021-07-10 17:24:26 +03:00
Leonid Yuriev
5ed50a4739 mdbx: remove filesize arg from header/meta read functions (refactoring). 2021-07-10 16:10:30 +03:00
Leonid Yuriev
c30c3def8b mdbx: the filesize field of mdbx_mmap_t now is not specific for Windows. 2021-07-10 16:10:30 +03:00
Леонид Юрьев (Leonid Yuriev)
2f74f405ae mdbx: avoid returning MDBX_TXN_FULL error when possible. 2021-07-09 18:29:31 +03:00
Leonid Yuriev
39c5e66ed1 mdbx: fix safe64_reset() for platforms without atomic 64-bit compare-and-swap. 2021-07-09 17:44:27 +03:00
Leonid Yuriev
bd2bb51f0f mdbx++: rework buffer::silo to avoid use std::string. 2021-07-06 13:45:26 +03:00
Leonid Yuriev
cf5f31c577 mdbx: make __cold attribute first (cosmetic). 2021-07-03 01:51:04 +03:00
Leonid Yuriev
fa49e5a57b mdbx++: rename slice::from/to_FOO_bytes() to `slice::envisage_from/to_FOO_length()'. 2021-07-02 21:20:04 +03:00
Leonid Yuriev
5d4281fbbe mdbx: minor fix spelling. 2021-06-26 18:54:00 +03:00
Leonid Yuriev
a5e10b4ea1 mdbx: minor refine mdbx_cursor_eof(). 2021-06-18 01:17:48 +03:00
Leonid Yuriev
b8e621cb2f mdbx: mdbx: avoid log a warning about empty header during DB creation.
Resolve https://github.com/erthink/libmdbx/issues/205.
2021-06-18 01:09:26 +03:00
Leonid Yuriev
5db855d728 mdbx: fix false-negative mdbx_cursor_eof() result.
Fixes https://github.com/erthink/libmdbx/issues/207.
2021-06-17 21:44:24 +03:00
Leonid Yuriev
d7c06b1337 mdbx: partial fix for recursive SRW-lock with MDBX_NOTLS on Windows.
Here are some changes to avoid recursive acquisition of SRW-lock,
which is still in use:
 - Read transactions don't acquire the shared SRW-lock with `MDBX_NOTLS.
 - Memory-mapping of DB is always kept while DB opened,
   therefore following limitations are:
 - DB file can't be shrinked while it used,
   including auto-shrink due to auto-compactification with corresponding geometry settings.
 - The upper limit of DB size can't be changed while DB is used.
 - The DB can grow within the upper size limit defined while opening by a first process,
   but this does not work under Wine since there is no `NtExtendSection()` function.

Partially fix https://github.com/erthink/libmdbx/issues/203
2021-06-10 13:42:30 +03:00
Leonid Yuriev
0cd1eac6a8 mdbx: don't check other meta pages if one is specified for verification/recovery.
Fixes https://github.com/erthink/libmdbx/issues/202
2021-06-08 20:27:18 +03:00
Leonid Yuriev
f951f246b8 mdbx: allow to predefine/override MDBX_BUILD_TIMESTAMP for builds reproducibility.
Resolve https://github.com/erthink/libmdbx/issues/201
2021-06-02 14:50:22 +03:00
Leonid Yuriev
ea1fcc2246 mdbx: fix insignificantly Coverity warnings. 2021-05-28 00:54:11 +03:00
Leonid Yuriev
8915db5f83 mdbx-tools: cleanup MDBX_NOSUBDIR (needless). 2021-05-28 00:36:24 +03:00
Leonid Yuriev
a7167ce715 mdbx: allow open DB on 9P/WSL2 filesystem in exclusive mode.
Related to https://github.com/erthink/libmdbx/issues/97
2021-05-26 21:08:37 +03:00
Leonid Yuriev
3e0c7758ef mdbx: fallback to non-OFD locks after EINVAL.
Related to https://github.com/erthink/libmdbx/issues/97
2021-05-26 20:33:55 +03:00
Leonid Yuriev
b0830db25a mdbx: add 9P (WSL2 DrvFs) to blacklist of remote filesystems.
Related to https://github.com/erthink/libmdbx/issues/97
2021-05-26 20:33:08 +03:00
Leonid Yuriev
bcc546bdfa mdbx-windows: refix WSL1/WSL2 detection.
Refix https://github.com/erthink/libmdbx/issues/97
2021-05-25 15:18:15 +03:00
Leonid Yuriev
6bedb02ac0 mdbx: fix lru-counter overflow by module 2^31.
2 of 2 fixes for https://github.com/erthink/libmdbx/issues/195
2021-05-20 17:42:22 +03:00
Leonid Yuriev
bc6a690733 mdbx: simplify & fix mdbx_txn_keep() and mdbx_cursor_keep().
1 of 2 fixes for https://github.com/erthink/libmdbx/issues/195
2021-05-20 15:10:38 +03:00
Leonid Yuriev
84b699a47c mdbx: fix elsif typo. 2021-05-18 22:44:31 +03:00
Leonid Yuriev
841fc15dd3 mdbx: little more likely/unlikely. 2021-05-12 19:24:19 +03:00
Leonid Yuriev
0875d16656 mdbx: fix/refine mdbx_env_info_ex() to distinguish a not-available and overflow cases for returned timestamps. 2021-05-12 17:51:31 +03:00
Leonid Yuriev
9c7c709b3e mdbx: avoid underflow during monotime/16dot16 conversion. 2021-05-12 17:44:18 +03:00
Leonid Yuriev
c5268f1da7 mdbx-tools: add support of page operations stat to mdbx_stat. 2021-05-12 14:41:09 +03:00
Leonid Yuriev
16d686bc42 mdbx: account msync/fsync write in page operations. 2021-05-12 14:40:58 +03:00
Leonid Yuriev
137f80e177 mdbx: refile rollback-writes inside mdbx_setup_dxb(). 2021-05-12 14:40:58 +03:00
Leonid Yuriev
7d8099fc77 mdbx: refine mdbx_wipe_steady(). 2021-05-12 14:40:58 +03:00
Leonid Yuriev
5731ad11c8 mdbx: don't use bool flags for mdbx_msync(). 2021-05-12 14:40:58 +03:00
Leonid Yuriev
76b9cb5dcc mdbx-tools: minor refine built-in usage/help. 2021-05-12 11:33:25 +03:00
Leonid Yuriev
9746dd20df mdbx-tools: refine/fix quiet mode. 2021-05-12 11:33:25 +03:00
Leonid Yuriev
ebab75642e mdbx: add public MDBX_MAYBE_UNUSED.
This also should fix C++ mdbx API build by MSVC 2015.
2021-05-11 21:07:40 +03:00
Leonid Yuriev
ed58ff9f81 mdbx++: add [[maybe_unused]] to internal functions which depends on platform and compiler features. 2021-05-11 16:53:47 +03:00
Leonid Yuriev
2071958f35 mdbx: remove extra notice/debug logging. 2021-05-11 00:24:01 +03:00
Leonid Yuriev
4fee14d1cf mdbx: logging all reasons of MDBX_PROBLEM.
Related to https://github.com/erthink/libmdbx/issues/195
2021-05-10 16:15:58 +03:00
Leonid Yuriev
244fab6c04 mdbx: fix extra conversion of an error during nested dupsort-DB update to MDBX_PROBLEM.
Hope this fixes https://github.com/erthink/libmdbx/issues/195
2021-05-10 16:15:03 +03:00
Leonid Yuriev
74ea79ac1b mdbx: minor reorder/shrink transaction fields. 2021-05-10 16:05:19 +03:00
Leonid Yuriev
0d100a898f mdbx: minor more const. 2021-05-10 15:53:07 +03:00
Леонид Юрьев (Leonid Yuriev)
aa1f6fbd5f
mdbx: release v0.10.0
Acknowledgements:
-----------------
 - [Mahlon E. Smith](https://github.com/mahlonsmith) for [Ruby bindings](https://rubygems.org/gems/mdbx/).
 - [Alex Sharov](https://github.com/AskAlexSharov) for [mdbx-go](https://github.com/torquem-ch/mdbx-go), bug reporting and testing.
 - [Artem Vorotnikov](https://github.com/vorot93) for bug reporting and PR.
 - [Paolo Rebuffo](https://www.linkedin.com/in/paolo-rebuffo-8255766/), [Alexey Akhunov](https://github.com/AlexeyAkhunov) and Mark Grosberg for donations.
 - [Noel Kuntze](https://github.com/Thermi) for preliminary [Python bindings](https://github.com/Thermi/libmdbx/tree/python-bindings)

New features:
-------------
 - Added `mdbx_env_set_option()` and `mdbx_env_get_option()` for controls
   various runtime options for an environment (announce of this feature  was missed in a previous news).
 - Added `MDBX_DISABLE_PAGECHECKS` build option to disable some checks to reduce an overhead
   and detection probability of database corruption to a values closer to the LMDB.
   The `MDBX_DISABLE_PAGECHECKS=1` provides a performance boost of about 10% in CRUD scenarios,
   and conjointly with the `MDBX_ENV_CHECKPID=0` and `MDBX_TXN_CHECKOWNER=0` options can yield
   up to 30% more performance compared to LMDB.
 - Using float point (exponential quantized) representation for internal 16-bit values
   of grow step and shrink threshold when huge ones (https://github.com/erthink/libmdbx/issues/166).
   To minimize the impact on compatibility, only the odd values inside the upper half
   of the range (i.e. 32769..65533) are used for the new representation.
 - Added the `mdbx_drop` similar to LMDB command-line tool to purge or delete (sub)database(s).
 - [Ruby bindings](https://rubygems.org/gems/mdbx/) is available now by [Mahlon E. Smith](https://github.com/mahlonsmith).
 - Added `MDBX_ENABLE_MADVISE` build option which controls the use of POSIX `madvise()` hints and friends.
 - The internal node sizes were refined, resulting in a reduction in large/overflow pages in some use cases
   and a slight increase in limits for a keys size to ≈½ of page size.
 - Added to `mdbx_chk` output number of keys/items on pages.
 - Added explicit `install-strip` and `install-no-strip` targets to the `Makefile` (https://github.com/erthink/libmdbx/pull/180).
 - Major rework page splitting (af9b7b560505684249b76730997f9e00614b8113) for
     - An "auto-appending" feature upon insertion for both ascending and
       descending key sequences. As a result, the optimality of page filling
       increases significantly (more densely, less slackness) while
       inserting ordered sequences of keys,
     - A "splitting at middle" to make page tree more balanced on average.
 - Added `mdbx_get_sysraminfo()` to the API.
 - Added guessing a reasonable maximum DB size for the default upper limit of geometry (https://github.com/erthink/libmdbx/issues/183).
 - Major rework internal labeling of a dirty pages (958fd5b9479f52f2124ab7e83c6b18b04b0e7dda) for
   a "transparent spilling" feature with the gist to make a dirty pages
   be ready to spilling (writing to a disk) without further altering ones.
   Thus in the `MDBX_WRITEMAP` mode the OS kernel able to oust dirty pages
   to DB file without further penalty during transaction commit.
   As a result, page swapping and I/O could be significantly reduced during extra large transactions and/or lack of memory.
 - Minimized reading leaf-pages during dropping subDB(s) and nested trees.
 - Major rework a spilling of dirty pages to support [LRU](https://en.wikipedia.org/wiki/Cache_replacement_policies#Least_recently_used_(LRU))
   policy and prioritization for a large/overflow pages.
 - Statistics of page operations (split, merge, copy, spill, etc) now available through `mdbx_env_info_ex()`.
 - Auto-setup limit for length of dirty pages list (`MDBX_opt_txn_dp_limit` option).
 - Support `make options` to list available build options.
 - Support `make help` to list available make targets.
 - Silently `make`'s build by default.
 - Preliminary [Python bindings](https://github.com/Thermi/libmdbx/tree/python-bindings) is available now
   by [Noel Kuntze](https://github.com/Thermi) (https://github.com/erthink/libmdbx/issues/147).

Backward compatibility break:
-----------------------------
 - The `MDBX_AVOID_CRT` build option was renamed to `MDBX_WITHOUT_MSVC_CRT`.
   This option is only relevant when building for Windows.
 - The `mdbx_env_stat()` always, and `mdbx_env_stat_ex()` when called with the zeroed transaction parameter,
   now internally start temporary read transaction and thus may returns `MDBX_BAD_RSLOT` error.
   So, just never use deprecated `mdbx_env_stat()' and call `mdbx_env_stat_ex()` with transaction parameter.
 - The build option `MDBX_CONFIG_MANUAL_TLS_CALLBACK` was removed and now just a non-zero value of
   the `MDBX_MANUAL_MODULE_HANDLER` macro indicates the requirement to manually call `mdbx_module_handler()`
   when loading libraries and applications uses statically linked libmdbx on an obsolete Windows versions.

Fixes:
------
 - Fixed performance regression due non-optimal C11 atomics usage (https://github.com/erthink/libmdbx/issues/160).
 - Fixed "reincarnation" of subDB after it deletion (https://github.com/erthink/libmdbx/issues/168).
 - Fixed (disallowing) implicit subDB deletion via operations on `@MAIN`'s DBI-handle.
 - Fixed a crash of `mdbx_env_info_ex()` in case of a call for a non-open environment (https://github.com/erthink/libmdbx/issues/171).
 - Fixed the selecting/adjustment values inside `mdbx_env_set_geometry()` for implicit out-of-range cases (https://github.com/erthink/libmdbx/issues/170).
 - Fixed `mdbx_env_set_option()` for set initial and limit size of dirty page list ((https://github.com/erthink/libmdbx/issues/179).
 - Fixed an unreasonably huge default upper limit for DB geometry (https://github.com/erthink/libmdbx/issues/183).
 - Fixed `constexpr` specifier for the `slice::invalid()`.
 - Fixed (no)readahead auto-handling (https://github.com/erthink/libmdbx/issues/164).
 - Fixed non-alloy build for Windows.
 - Switched to using Heap-functions instead of LocalAlloc/LocalFree on Windows.
 - Fixed `mdbx_env_stat_ex()` to returning statistics of the whole environment instead of MainDB only (https://github.com/erthink/libmdbx/issues/190).
 - Fixed building by GCC 4.8.5 (added workaround for a preprocessor's bug).
 - Fixed building C++ part for iOS <= 13.0 (unavailability of  `std::filesystem::path`).
 - Fixed building for Windows target versions prior to Windows Vista (`WIN32_WINNT < 0x0600`).
 - Fixed building by MinGW for Windows (https://github.com/erthink/libmdbx/issues/155).

TODO for a next releases:
-------------------------
 - [Get rid of dirty-pages list in MDBX_WRITEMAP mode](https://github.com/erthink/libmdbx/issues/193).
 - [Large/Overflow pages accounting for dirty-room](https://github.com/erthink/libmdbx/issues/192).
 - [C++ Buffer issue](https://github.com/erthink/libmdbx/issues/191).
 - Finalize C++ API (few typos and trivia bugs are still likely for now).
 - [Support for RAW devices](https://github.com/erthink/libmdbx/issues/124).
 - [Test framework issue](https://github.com/erthink/libmdbx/issues/127).
 - [Support MessagePack for Keys & Values](https://github.com/erthink/libmdbx/issues/115).
 - [Engage new terminology](https://github.com/erthink/libmdbx/issues/137).
 - Packages for [Astra Linux](https://astralinux.ru/), [ALT Linux](https://www.altlinux.org/), [ROSA Linux](https://www.rosalinux.ru/), Fedora/RHEL, Debian/Ubuntu.
2021-05-09 03:01:59 +03:00
Leonid Yuriev
43f1823cdc mdbx: minor alignment fix for lck-less stub to avoid false-positive alarm from UndefinedBehaviorSanitize.
Change-Id: I8d9bc00ccfc7228cb42f9419cf77e8eadb92f918
2021-05-08 22:43:16 +03:00
Leonid Yuriev
e75033b1f4 mdbx: drop some unused stuff.
Change-Id: I136dcf891757d5c1a35a8082ee90e8cf07c016c6
2021-05-08 18:40:14 +03:00
Leonid Yuriev
ecd3c06932 mdbx-windows: remove MDBX_CONFIG_MANUAL_TLS_CALLBACK build option and add MDBX_MANUAL_MODULE_HANDLER macro.
Briefly:
 - Now constructor/destructor of "Thread Local Storage" handled automatically when possible.
 - Otherwise the MDBX_CONFIG_MANUAL_TLS_CALLBACK macro defined to 1 to indicate that mdbx_module_handle() should be called manually.
 - Corresponding build option MDBX_CONFIG_MANUAL_TLS_CALLBACK was removed.

Related to https://github.com/erthink/libmdbx/issues/155

Change-Id: Ic4e6a34b44f874676f0ab212ff473460e3d80559
2021-05-08 18:39:18 +03:00
Leonid Yuriev
11a521f10a mdbx-windows: minor fix mdbx_free() for MDBX_WITHOUT_MSVC_CRT=ON.
Related to https://github.com/erthink/libmdbx/issues/155

Change-Id: I378d9c47b51c55e1e61bc7f6269cbc8182265870
2021-05-08 18:38:53 +03:00
Leonid Yuriev
5ae120af80 mdbx-windows: more crutches for MinGW.
More for https://github.com/erthink/libmdbx/issues/155

Change-Id: I7de6122ff160372b2dcfd2a0a26e332cb52d0560
2021-05-08 18:38:44 +03:00
Leonid Yuriev
33e8b19ea4 mdbx-windows: check _WIN32_WINNT definition.
Related to https://github.com/erthink/libmdbx/issues/155

Change-Id: I49c294bd0fa055026b742a12a6f6ea9cd805cf02
2021-05-08 18:38:36 +03:00
Leonid Yuriev
ab1fc94a5b mdbx-windows: fix build for Windows XP/2000 (_WIN32_WINNT < 0x0600).
Related to https://github.com/erthink/libmdbx/issues/155

Change-Id: Ibd795817e05b6da39ef270ce7b55b31d963d07b0
2021-05-08 18:38:26 +03:00
Leonid Yuriev
c15ad25073 mdbx: add minor workaround for E2K LCC's bug.
Related to https://bugs.mcst.ru/bugzilla/show_bug.cgi?id=6011

Change-Id: I562dbcedb3c172e0646dcb03ef6d5cd3f14e02b9
2021-05-07 19:05:10 +03:00
Leonid Yuriev
a14d6bcb11 mdbx: fix mis-defined MDBX_FORCE_ASSERTIONS.
Change-Id: I6f7ad4fdd6aca99a4f908d634af0015a6e95c0d1
2021-05-06 17:03:57 +03:00
Leonid Yuriev
1275bdb623 mdbx: add MDBX_opt_merge_threshold_16dot16_percent option.
Change-Id: I416f85096e4b6fd21f2db622f07f31103cb9074a
2021-05-06 02:05:33 +03:00
Leonid Yuriev
7d54518d60 mdbx: add workaround for GCC 4.8 preprocessor bug.
Change-Id: I965cfbcd43596ef896a6b849dd043804bdb3f41f
2021-05-03 15:00:53 +03:00
Leonid Yuriev
d6e67e3982 mdbx: minor retine options.h
Change-Id: Ic340e6cea25df3e5dddf920ba851e39e714033e0
2021-05-03 15:00:53 +03:00
Leonid Yuriev
c914d417d2 mdbx: refine Doxygen's API description.
Change-Id: Ifd326eded287c68c6a95b6c9be22847d6efa5678
2021-05-03 15:00:53 +03:00
Leonid Yuriev
df387ad943 mdbx: fix minor MSVC warnings.
Change-Id: I9a2c774f6020bbe5c77e423a1f54110b12bdcb41
2021-05-02 17:11:50 +03:00
Leonid Yuriev
732d3cd2d4 mdbx: fix/rework mdbx_env_stat_ex() to return stat of the whole env.
Resolves https://github.com/erthink/libmdbx/issues/190

Included fix for the first version of this change.

Change-Id: I8357de24fda2ab4c93510574055b52d6e16b0c15
2021-05-02 17:10:37 +03:00
Leonid Yuriev
a56c72d190 mdbx: minor refine internal audit.
Change-Id: I0e177e9c9ecf1da97084c175f80b3e987391194c
2021-05-02 15:14:30 +03:00
Leonid Yuriev
9ba8d5892a mdbx-tools: avoid use mdbx_env_stat_ex().
Change-Id: I484ead640967b3a6caa3c2536983a34956ae1827
2021-05-01 21:20:18 +03:00
Leonid Yuriev
fe04c98327 mdbx-tools: cosmetic refine mdbx_chk.
Change-Id: I815baf437d9e0af3c78f9df717b0fb669863993c
2021-05-01 20:40:52 +03:00
Leonid Yuriev
0054f5388a mdbx-windows: use Heap-functions instead of LocalAlloc/LocalFree.
Change-Id: I85f8a4c888bf98f4792f2a5e522d24ee671f060c
2021-04-30 02:24:36 +03:00
Leonid Yuriev
161b00a4b6 mdbx: refine/rearrange build options.
Change-Id: Ic27bf2b1f22e7ed9e6a1db9a1ed2496b1bb1239b
2021-04-30 02:01:22 +03:00
Leonid Yuriev
6b6165cdeb mdbx: rename internal defines/macros to distinguish it from build options.
Change-Id: I42fe240e6ddd5d34c8fec38633849ebdcce0e116
2021-04-30 01:59:48 +03:00
Leonid Yuriev
d27e48ae1b mdbx-windows: rename MDBX_AVOID_CRT build option to MDBX_DISABLE_MSVC_CRT.
Change-Id: I124c9d86d4a596718bd9671a7c1b538b84c2dd0f
2021-04-30 01:59:48 +03:00
Leonid Yuriev
c3b2c1fdef mdbx: handling the case when all dirty pages are unspillable.
Related to https://github.com/erthink/libmdbx/issues/186

Change-Id: Iff7a123c1c171371624d8b7ae497941ec4622385
2021-04-28 23:38:41 +03:00
Leonid Yuriev
aa5a39160a mdbx: internal build option for debuging dirtyroom reservation and spilling.
Related to https://github.com/erthink/libmdbx/issues/186

Change-Id: Ia315ae2cae5f5b5b82891843de22487db0139df3
2021-04-28 23:38:38 +03:00
Leonid Yuriev
39230c9a22 mdbx: more debug/loggin for LRU spilling.
Related to https://github.com/erthink/libmdbx/issues/186

Change-Id: Ifcfabf8864830adf3c50fe8d01d24cccb950dcbb
2021-04-28 23:38:34 +03:00
Leonid Yuriev
9fed78c92d mdbx: fix LRU spilling internal prio celling.
Related to https://github.com/erthink/libmdbx/issues/186

Change-Id: Ia4be12e063d1754a38889dc311eb1314b3676c21
2021-04-28 23:38:32 +03:00
Leonid Yuriev
329a2a50e6 mdbx: account loose-pages during spilling and do purge ones if a lack of dirtyroom.
Related to https://github.com/erthink/libmdbx/issues/186

Change-Id: I50c11195ad31615181f8359e123c1ffe2ebcfc30
2021-04-28 23:38:29 +03:00
Leonid Yuriev
17116b9b46 mdbx: raise MDBX_TXN_FULL if spilled less that half of needed.
Related to https://github.com/erthink/libmdbx/issues/186

Change-Id: I3c1a0e1bea6b6ad9bf41347a569e5833e82d8edc
2021-04-28 23:38:26 +03:00
Leonid Yuriev
e57e42d0f8 mdbx: use single pointer to lck-less stub.
Change-Id: I80542423386bd54cac574d1678af2620f147c769
2021-04-28 23:38:26 +03:00
Leonid Yuriev
7d249c97ad mdbx: double dirtyroom reserve for page stack.
Related to https://github.com/erthink/libmdbx/issues/186

Change-Id: I211fc9c849c9a45254e699d713475898fd20a58e
2021-04-28 23:38:24 +03:00
Leonid Yuriev
4111d7238c mdbx: spill pages during prepare backlog for update_gc().
Related to https://github.com/erthink/libmdbx/issues/186

Change-Id: I88463a860da0a53420904daf1b1f39e5ca4c97e5
2021-04-28 23:38:21 +03:00
Leonid Yuriev
760cf515a7 mdbx: minor refactoring cursor_put().
Change-Id: Iacdc02f70278382bf0e7fb496bb57f4010403dd0
2021-04-28 23:38:21 +03:00
Leonid Yuriev
7cbd500534 mdbx: minor simplify dirtyroom accounting.
Related to https://github.com/erthink/libmdbx/issues/186

Change-Id: Ia0afcffe5a245aaa9500edc70b2cbca1735070ac
2021-04-28 23:38:19 +03:00
Leonid Yuriev
89558657ea mdbx: auto-setup MDBX_opt_txn_dp_limit.
Related to https://github.com/erthink/libmdbx/issues/186

Change-Id: I8f8c4f1a2600462bc25b4fad3010a4e6ac70b386
2021-04-28 23:38:16 +03:00
Leonid Yuriev
6134220b8a mdbx: drop P_KEEP flag and use LRU-label insted of.
Related to https://github.com/erthink/libmdbx/issues/186

Change-Id: Ifd3bd2533b40525dd5b0aa05df421c87462c2439
2021-04-28 23:37:48 +03:00
Leonid Yuriev
975413b48d mdbx: more for page operation statistics.
Change-Id: I19fc26dfc9f9627eecc8d505e95d33bad76f2b2f
2021-04-27 18:19:13 +03:00
Leonid Yuriev
f95a277ac5 mdbx: statistics of page operations.
Related to https://github.com/erthink/libmdbx/issues/186

Change-Id: Ia00e6e0df9a65f880517ca33e7f444a0526b96e1
2021-04-27 18:02:11 +03:00
Leonid Yuriev
3bbf5d03e2 mdbx: lowering the logging level for page unspill.
Change-Id: I03f9bdaa644534d1c1e257e0394549c90a56d612
2021-04-27 16:58:35 +03:00
Leonid Yuriev
13a784eeed mdbx: rearrange MDBX_env ro/rw fields.
Change-Id: I055aa6ad592930be2d5d676977fbaa84149472ce
2021-04-27 16:58:31 +03:00
Leonid Yuriev
8b95be91db mdbx: fix minor Coverity warnings.
Change-Id: Id6ab528b597e62b05b5fc4ab87bbe93cbce6573c
2021-04-27 00:12:09 +03:00
Leonid Yuriev
427b480f68 mdbx: add MDBX_FAKE_SPILL_WRITEMAP build option.
Change-Id: I2c7f9267b0e725674b8bc73547bedd8478231948
2021-04-26 18:18:51 +03:00
Leonid Yuriev
4fa5e95241 mdbx: LRU spilling feature (squashed).
Resolves https://github.com/erthink/libmdbx/issues/186

Change-Id: Ie3318964e4e2adbeb77738b8301c45075080850b
2021-04-26 17:51:11 +03:00
Leonid Yuriev
3e272d339a mdbx: drop mdbx_dpl_find() and always promote child LRU-serial to the parent txn.
More for https://github.com/erthink/libmdbx/issues/186

Change-Id: Ifeac634e9fa1dee6e2b3375c868cc0fa16422099
2021-04-26 14:08:30 +03:00