Commit Graph

2660 Commits

Author SHA1 Message Date
Леонид Юрьев (Leonid Yuriev)
b015557bb3 mdbx: refactoring fetch/refresh/create/open tables and DBI-handles. 2025-11-05 14:48:17 +03:00
Леонид Юрьев (Leonid Yuriev)
c5a53dd525 mdbx: ending the transaction and return an error in case reader-slot was evicted. 2025-11-05 12:13:11 +03:00
Леонид Юрьев (Leonid Yuriev)
354c604065 mdbx: refine description of MDBX_BAD_RSLOT. 2025-11-05 12:08:13 +03:00
Леонид Юрьев (Leonid Yuriev)
5e362b82e8 mdbx: clean reader locktable by rthc_drown() only when no inprocess-neighbor. 2025-11-05 01:20:25 +03:00
Леонид Юрьев (Leonid Yuriev)
ffb822cb61 mdbx: refine internal env_info_sys(). 2025-11-05 01:20:10 +03:00
Леонид Юрьев (Leonid Yuriev)
7f8e3c8781 mdbx: more refining chk-output. 2025-11-05 01:20:10 +03:00
Леонид Юрьев (Leonid Yuriev)
916e6e817d mdbx: refine handling sys_allocation_granularity. 2025-11-05 01:20:10 +03:00
Леонид Юрьев (Leonid Yuriev)
bf3f9be98a mdbx: using clang-format-22. 2025-11-05 01:20:10 +03:00
Леонид Юрьев (Leonid Yuriev)
7b112df36e mdbx: fix unused functions warning from modern clang. 2025-11-05 01:20:10 +03:00
Леонид Юрьев (Leonid Yuriev)
baf3eb267f mdbx: fix extra type-casting typo. 2025-11-05 01:20:10 +03:00
Леонид Юрьев (Leonid Yuriev)
0b24446e8e mdbx: fix typo assertion-failure regression. 2025-11-05 01:20:09 +03:00
Леонид Юрьев (Leonid Yuriev)
0838af8f3d mdbx-tools: cleanup mdbx_stat from float-point. 2025-11-05 01:20:09 +03:00
Леонид Юрьев (Leonid Yuriev)
255a431bc1 mdbx-tools: cleanup mdbx_chk from float-point. 2025-11-05 01:20:09 +03:00
Леонид Юрьев (Leonid Yuriev)
dccc807aff mdbx: add float-point-free mdbx_ratio2percents() and mdbx_ratio2digits() to API for tools. 2025-11-05 01:20:09 +03:00
Леонид Юрьев (Leonid Yuriev)
8b2aa9fb65 mdbx: add getenv_bool() and fetching debug-options from the process environment. 2025-11-05 01:20:09 +03:00
Леонид Юрьев (Leonid Yuriev)
0d9b59dda1 mdbx: add osal_strcasecmp() and osal_strncasecmp(). 2025-11-05 01:20:09 +03:00
Леонид Юрьев (Leonid Yuriev)
65184ff73b mdbx: rework/refine chk reporting tree/pages/tables information (squashed). 2025-11-05 01:20:09 +03:00
Леонид Юрьев (Leonid Yuriev)
b8f4d6ccdd mdbx: rename "other" pages to "broken" in chk-output. 2025-11-05 01:20:09 +03:00
Леонид Юрьев (Leonid Yuriev)
c466dea250 mdbx: clean library core from using a float-point. 2025-11-05 01:20:09 +03:00
Леонид Юрьев (Leonid Yuriev)
1cf65cd880 mdbx: refine handling the MDBX_WITHOUT_MSVC_CRT option. 2025-11-05 01:20:09 +03:00
Леонид Юрьев (Leonid Yuriev)
7e43e14c7b mdbx: more info-output from mdbx_env_chk().
Print system io-block size, unified-page-cache block size, space allocated for the dxb-file in a filesystem.
2025-11-05 01:20:09 +03:00
Леонид Юрьев (Leonid Yuriev)
410bbbd9a5 mdbx: extending MDBX_envinfo. 2025-11-05 01:20:09 +03:00
Леонид Юрьев (Leonid Yuriev)
06b6739e68 mdbx: fix assertion inside gc_alloc_ex(). 2025-11-05 01:20:09 +03:00
Леонид Юрьев (Leonid Yuriev)
045968b46a mdbx: fix txn_basis_snapshot(). 2025-11-05 01:20:09 +03:00
Леонид Юрьев (Leonid Yuriev)
60d5ba9790 mdbx: minor workaround for HarmonyOS's bug.
The libc from HarmonyOS SDK erroneously defines `EOWNERDEAD`,
`_POSIX_THREAD_PROCESS_SHARED >= 200809` and `PTHREAD_MUTEX_ROBUST` but
the same time doesn't provide `pthread_mutexattr_setrobust()` and
`pthread_mutex_consistent()`.

This commit add a minor workaround for such bug for successful building
without explicitly defining `MDBX_LOCKING=2001`.

Related to https://github.com/erthink/libmdbx/issues/285, https://github.com/vorot93/libmdbx-rs/issues/41, https://github.com/isar-community/isar-community/issues/28.
2025-10-29 00:10:06 +03:00
Leonid Yuriev
43c4503a77 mdbx: minor clean-up tautology in assertion. 2025-10-26 18:02:04 +03:00
Leonid Yuriev
aafe0f0fba mdbx: use Windows10 SDK by default. 2025-10-26 18:02:04 +03:00
Леонид Юрьев (Leonid Yuriev)
dc5f119de1 mdbx-cmake: support of MDBX_USE_FALLOCATE for CMake and Conan. 2025-10-20 12:52:36 +03:00
Леонид Юрьев (Leonid Yuriev)
2b0bfb9eea mdbx: revert/drop MDBX_DBG_NOFALLOC_INCORE and introduce osal_fsetsize().
This fixes regression after the 2a7f460345 as when
a DXB file remains longer than necessary on Mac or Linux when building without `_GNU_SOURCE`.
2025-10-18 12:36:29 +03:00
Леонид Юрьев (Leonid Yuriev)
ee6a045f17 mdbx: add MDBX_DBG_NOFALLOC_INCORE.
It is a workaround to sporadic test failures due to lack of space in tmpfs and/or free memory.
2025-10-09 23:26:18 +03:00
Леонид Юрьев (Leonid Yuriev)
bdbbf3db68 mdbx: fix rare/specific unexpected assertion failure bmi > 0 on 32-bit debug builds. 2025-09-11 19:06:14 +03:00
Леонид Юрьев (Leonid Yuriev)
f2a5ca26a6 mdbx: using atomic_yield() inside safe64_read() retry loop. 2025-09-09 22:26:40 +03:00
Леонид Юрьев (Leonid Yuriev)
4adba731f5 mdbx: introduce internal lck_setlk_with3retries() as workaround EAGAIN on Android. 2025-09-08 10:46:30 +03:00
Леонид Юрьев (Leonid Yuriev)
815d483803 mdbx: extract internal osal_yield(). 2025-09-08 10:32:17 +03:00
Леонид Юрьев (Leonid Yuriev)
74ef6502e3 mdbx-windows: move the LockFileEx(LOCKFILE_FAIL_IMMEDIATELY) repeats for using in all cases. 2025-09-07 13:33:13 +03:00
Леонид Юрьев (Leonid Yuriev)
cd27aa017f mdbx: add internal txn_basis_snapshot(). 2025-09-07 00:28:58 +03:00
Леонид Юрьев (Leonid Yuriev)
222d8f13f8 mdbx: extract internal check_key(). 2025-09-07 00:28:29 +03:00
Леонид Юрьев (Leonid Yuriev)
d7e3c2a0fc mdbx: add internal ptr2page(). 2025-09-07 00:28:22 +03:00
Леонид Юрьев (Leonid Yuriev)
eee21feba7 mdbx: rename internal page2payload() and payload2page(). 2025-09-07 00:28:02 +03:00
Леонид Юрьев (Leonid Yuriev)
9ad4fe8f96 mdbx: refine ceil/rounding to be perfectly close to system allocation granularity. 2025-09-03 22:50:29 +03:00
Леонид Юрьев (Leonid Yuriev)
9c0886972d mdbx: alter the globals.sys_allocation_granularity guessing. 2025-09-03 21:38:05 +03:00
Леонид Юрьев (Leonid Yuriev)
26d5ef6b2d mdbx: add xyz_ceil2ag_xyz(), i.e. ceiling to system allocation granularity. 2025-09-03 21:38:05 +03:00
Леонид Юрьев (Leonid Yuriev)
41abfffeb3 mdbx: rename xyz_align2os_xyz() to xyz_ceil2sp_xyz() (cosmetics). 2025-09-03 20:18:41 +03:00
Леонид Юрьев (Leonid Yuriev)
c97a31b47b mdbx: fix inappropriate/irrelevant MDBX_WANNA_RECOVERY when the DB size is not rounded to sys-allocation-granularity (imported from the stable branch).
For now this is just the patch that eliminates regression by making the
least risky/invasive changes. However a complete fix involves refining
the rounding of a database size, which still is to do.

The check corrected by this commit was never fundamentally important,
but it was added to verify the logic of rounding the database size in
various cases.
However, after the commit `2a7f460345edbeb26a51782cbe6af3c55254ae77`
(using `fallocate()` to prevent `SIGBUS`), the behavior change led to
the returning error `MDBX_WANNA_RECOVERY` in fairly harmless conditions.
2025-08-29 13:18:10 +03:00
Леонид Юрьев (Leonid Yuriev)
e03f16999c mdbx: cleanup extra changes after the 5c6d91f7c. 2025-08-24 09:34:42 +03:00
Леонид Юрьев (Leonid Yuriev)
109858b994 mdbx-test: workaround for the ENOSPC from a tmpfs. 2025-08-24 09:34:42 +03:00
Леонид Юрьев (Leonid Yuriev)
466062151f mdbx: cleanup redundant MDBX_INTERNAL. 2025-08-24 09:34:42 +03:00
Леонид Юрьев (Leonid Yuriev)
2a7f460345 mdbx: fix unexpected SIGBUS is not enough space in a filesystem.
On a modern Linux the allocation of space for a file can be deferred
and/or lazy, rather than when setting its length using `ftruncate()`.
The actual allocation of space occurs when writing to the corresponding
areas of the file, or when reading ones (in this case, the file system
fills these areas with zeros).

The specific behavior depends on the type of file system and the kernel
version, but the main thing is that possibilities currently are, when
setting the file size, just the instantaneous ability to allocate space
is checked, without any booking.

If the file system is running out of space, an `ENOSPC` error may occur
when processing (inside a OS kernel) a page fault when accessing one of
the added pages after the database has been enlarged. In this case, the
OS kernel has no other alternative but to send a `SIGBUS` signal to the
process.

This commit fixes the problem by adding the use of system calls to
explicitly allocate space for a given file size.
Related-to https://github.com/erigontech/erigon/issues/16709

This is a simple improvement, however which is complicated by the need
to take into account the availability of the appropriate system API and
handle non-fatal errors from file systems that do not support the
appropriate operations. Therefore, there is a risk of regressions in
unusual/rare situations, including when hosting databases on network
media.
2025-08-22 13:46:49 +03:00
Леонид Юрьев (Leonid Yuriev)
43be7b05a7 mdbx: enabling older Linux kernels starting from 3.16 2025-08-05 12:44:13 +03:00
Леонид Юрьев (Leonid Yuriev)
933565b1b2 mdbx-chk: count and report %-filling histogram of tree(s). 2025-07-29 14:50:47 +03:00