- Copyright
- SPDX-License-Identifier: Apache-2.0
- Author
- Леонид Юрьев aka Leonid Yuriev leo@y.nosp@m.urie.nosp@m.v.ru
- Date
- 2015-2026
The libmdbx build options.
◆ MDBX_64BIT_ATOMIC
| #define MDBX_64BIT_ATOMIC 1 |
◆ MDBX_64BIT_CAS
◆ MDBX_APPLE_SPEED_INSTEADOF_DURABILITY
◆ MDBX_ASSUME_MALLOC_OVERHEAD
| #define MDBX_ASSUME_MALLOC_OVERHEAD (sizeof(void *) * 2u) |
Presumed malloc size overhead for each allocation to adjust allocations to be more aligned.
◆ MDBX_AUXILARY_IOV_MAX
| #define MDBX_AUXILARY_IOV_MAX 64 |
◆ MDBX_AVOID_MSYNC
| #define MDBX_AVOID_MSYNC 0 |
Controls dirty pages tracking, spilling and persisting in MDBX_WRITEMAP.
In other words, disables in-memory database updating with consequent flush-to-disk/msync syscall.
0/OFF = Don't track dirty pages at all, don't spill ones, and use msync() to persist data. This is by-default on Linux and other systems where kernel provides properly LRU tracking and effective flushing on-demand.
1/ON = Tracking of dirty pages but with LRU labels for spilling and explicit persist ones by write(). This may be reasonable for goofy systems (Windows) which low performance of msync() and/or zany LRU tracking.
◆ MDBX_BUILD_METADATA
| #define MDBX_BUILD_METADATA "" |
◆ MDBX_CACHELINE_SIZE
| #define MDBX_CACHELINE_SIZE 64 |
◆ MDBX_CHECKING
| #define MDBX_CHECKING -1...3 |
Controls enabling of all kind of assertion-like checks. By default MDBX_CHECKING defined same as MDBX_DEBUG, but can be overridden just by a definition.
- MDBX_CHECKING = 0 Disables all assertion-like checks except those enforced using ENSURE() macros. Debug flags MDBX_DBG_ASSERT and MDBX_DBG_AUDIT changing by mdbx_setup_debug() has no effect.
- MDBX_CHECKING = 1 Enables lite-costs checks by CHECK0() and ASSERT() macros, which are then always active in code and NOT controlled by the MDBX_DBG_ASSERT flag, since the cost of such control is comparable to a checks itself. Debug flags MDBX_DBG_ASSERT and MDBX_DBG_AUDIT changing by mdbx_setup_debug() has no effect.
- MDBX_CHECKING = 2 Additionally to MDBX_CHECKING=1 enables medium-costs checks by CHECK1(), which are then could be activated either disabled by the MDBX_DBG_ASSERT flag.
- MDBX_CHECKING = 3 Additionally to MDBX_CHECKING=2 enables high-costs checks by CHECK2(), which are then could be activated either disabled by the MDBX_DBG_ASSERT flag.
- MDBX_CHECKING < 0 Explicitly disables all checks, including ENSURE() macros. Debug flags MDBX_DBG_ASSERT and MDBX_DBG_AUDIT changing by mdbx_setup_debug() has no effect.
◆ MDBX_CPU_WRITEBACK_INCOHERENT
| #define MDBX_CPU_WRITEBACK_INCOHERENT 0 |
◆ MDBX_DEBUG
Controls enabling of debugging features, Mostly controls logging but also assertion checking via defining default value of MDBX_CHECKING option.
- MDBX_DEBUG = 0 (by default) Disables any debugging features, including logging and assertion controls. Logging level and corresponding debug flags changing by mdbx_setup_debug() has no effect.
- MDBX_DEBUG > 0 Enables code for the debugging features (logging, assertions checking and internal audit). Simultaneously sets the default logging level to the MDBX_DEBUG value. Also enables MDBX_DBG_AUDIT if MDBX_DEBUG >= 3.
- MDBX_DEBUG < 0 Disables logging and error reporting at all, including any critical cases.
◆ MDBX_DISABLE_GNU_SOURCE
| #define MDBX_DISABLE_GNU_SOURCE 0 or 1 |
Disables using of GNU libc extensions.
◆ MDBX_DISABLE_VALIDATION
| #define MDBX_DISABLE_VALIDATION 0 |
Disable some checks to reduce an overhead and detection probability of database corruption to a values closer to the LMDB.
◆ MDBX_DML_PREALLOC_FOR_RADIXSORT
| #define MDBX_DML_PREALLOC_FOR_RADIXSORT 1 |
◆ MDBX_DPL_CACHE_NPAGES
| #define MDBX_DPL_CACHE_NPAGES 0 |
◆ MDBX_DPL_PREALLOC_FOR_RADIXSORT
| #define MDBX_DPL_PREALLOC_FOR_RADIXSORT 1 |
◆ MDBX_ENABLE_BIGFOOT
| #define MDBX_ENABLE_BIGFOOT 1 |
Enables chunking long list of retired pages during huge transactions commit to avoid use sequences of pages.
◆ MDBX_ENABLE_BUNCHES_REMOVAL
| #define MDBX_ENABLE_BUNCHES_REMOVAL 1 |
Enables fast deletion by whole b-tree branches feature.
◆ MDBX_ENABLE_DBI_LOCKFREE
| #define MDBX_ENABLE_DBI_LOCKFREE 1 |
Controls support of lock-free opening of DBI-handles and deferred destroying ones.
◆ MDBX_ENABLE_DBI_SPARSE
| #define MDBX_ENABLE_DBI_SPARSE 1 |
Controls a supporting sparse sets of DBI-handles to reduce transaction startup and processing overhead.
◆ MDBX_ENABLE_FAKE_NESTED_READONLY_TRANSACTIONS
| #define MDBX_ENABLE_FAKE_NESTED_READONLY_TRANSACTIONS 0 |
Enables fake nested read-only transactions, which are much cheaper but do not restore the state of cursors in case of transaction abortion.
◆ MDBX_ENABLE_NON_READONLY_EXPORT
| #define MDBX_ENABLE_NON_READONLY_EXPORT 0 |
if enabled then instead of the returned error MDBX_REMOTE, only a warning is issued, when the database being opened in non-read-only mode is located in a file system exported via NFS.
◆ MDBX_ENABLE_PGET_STAT
| #define MDBX_ENABLE_PGET_STAT 1 |
Controls the collection of statistics on pages access operations for each transaction.
◆ MDBX_ENABLE_PGOP_STAT
| #define MDBX_ENABLE_PGOP_STAT 1 |
Controls the collection of statistics on pages modification operations.
◆ MDBX_ENABLE_PROFGC
| #define MDBX_ENABLE_PROFGC 0 |
Controls profiling of GC search and updates.
◆ MDBX_ENABLE_REFUND
| #define MDBX_ENABLE_REFUND 1 |
Controls online database auto-compactification during write-transactions.
◆ MDBX_ENV_CHECKPID
| #define MDBX_ENV_CHECKPID 1 |
Controls checking PID against reuse DB environment after the fork()
◆ MDBX_ENVCOPY_WRITEBUF
| #define MDBX_ENVCOPY_WRITEBUF 1048576u |
Size of buffer used during copying a environment/database file.
◆ MDBX_FORCE_ASSERTIONS
| #define MDBX_FORCE_ASSERTIONS 0 |
◆ MDBX_HAVE_BUILTIN_CPU_SUPPORTS
| #define MDBX_HAVE_BUILTIN_CPU_SUPPORTS 0 |
If defined then enables integration with Valgrind, a memory analyzing tool. If defined then enables use C11 atomics, otherwise detects ones availability automatically. If defined then enables use the GCC's __builtin_cpu_supports() for runtime dispatching depending on the CPU's capabilities.
- Note
- Defining MDBX_HAVE_BUILTIN_CPU_SUPPORTS to 0 should avoided unless build for particular single-target platform, since on AMD64/x86 this disables dynamic choice (at runtime) of SSE2 / AVX2 / AVX512 instructions with fallback to non-accelerated baseline code.
◆ MDBX_HISTOGRAM_USING_128BIT
| #define MDBX_HISTOGRAM_USING_128BIT 0 |
◆ MDBX_LOCKING
Advanced: Choices the locking implementation (autodetection by default).
◆ MDBX_LOCKING_POSIX1988
| #define MDBX_LOCKING_POSIX1988 1988 |
◆ MDBX_LOCKING_POSIX2001
| #define MDBX_LOCKING_POSIX2001 2001 |
◆ MDBX_LOCKING_POSIX2008
| #define MDBX_LOCKING_POSIX2008 2008 |
◆ MDBX_LOCKING_SYSV
| #define MDBX_LOCKING_SYSV 5 |
◆ MDBX_LOCKING_WIN32FILES
| #define MDBX_LOCKING_WIN32FILES -1 |
◆ MDBX_MMAP_INCOHERENT_CPU_CACHE
| #define MDBX_MMAP_INCOHERENT_CPU_CACHE 0 |
◆ MDBX_MMAP_INCOHERENT_FILE_WRITE
| #define MDBX_MMAP_INCOHERENT_FILE_WRITE 0 |
◆ MDBX_MMAP_NEEDS_JOLT
| #define MDBX_MMAP_NEEDS_JOLT 1 |
Assume system needs explicit syscall to sync/flush/write modified mapped memory.
◆ MDBX_MMAP_NEEDS_JOLT_CONFIG
◆ MDBX_NOSUCCESS_PURE_COMMIT
| #define MDBX_NOSUCCESS_PURE_COMMIT 0 |
if enabled then treats the commit of pure (nothing changes) transactions as special cases and return MDBX_RESULT_TRUE instead of MDBX_SUCCESS.
◆ MDBX_OSX_WANNA_DURABILITY
| #define MDBX_OSX_WANNA_DURABILITY 0 |
Using fcntl(F_FULLFSYNC) with 5-10 times slowdown
◆ MDBX_OSX_WANNA_SPEED
| #define MDBX_OSX_WANNA_SPEED 1 |
Using fsync() with chance of data lost on power failure
◆ MDBX_PNL_PREALLOC_FOR_RADIXSORT
| #define MDBX_PNL_PREALLOC_FOR_RADIXSORT 1 |
◆ MDBX_ROUNDING_TO_ALLOCATION_GRANULARITY
| #define MDBX_ROUNDING_TO_ALLOCATION_GRANULARITY 0 |
Forces rounding size of memory mapped regions and files to system allocation granularity rather to system page size.
In most operating systems, RAM is allocated in larger chunks consisting of several pages. Thus, rounding up to the size of the system page, rather than the actual size of the block used for memory allocation, does not save resources, but only hides what is really happening. On the other hand, system allocation granularity may depend not only on the type of operating system, but also on the version, settings, and amount of available resources (RAM), so increasing the rounding unit may lead to doubtful and unexpected behavior for the user.
◆ MDBX_TRUST_RTC
Does a system have battery-backed Real-Time Clock or just a fake.
◆ MDBX_TXN_CHECKOWNER
| #define MDBX_TXN_CHECKOWNER 1 |
Controls checking transaction owner thread against misuse transactions from other threads.
◆ MDBX_UNALIGNED_OK
| #define MDBX_UNALIGNED_OK 0 /* no unaligned access allowed */ |
◆ MDBX_USE_COPYFILERANGE
| #define MDBX_USE_COPYFILERANGE 0 |
Advanced: Using copy_file_range() syscall (autodetection by default).
◆ MDBX_USE_FALLOCATE
| #define MDBX_USE_FALLOCATE 0 |
Advanced: Using posix_fallocate() or fcntl(F_PREALLOCATE) on OSX (autodetection by default).
◆ MDBX_USE_FALLOCATE_CONFIG
◆ MDBX_USE_MINCORE
| #define MDBX_USE_MINCORE 1 |
Controls using Unix' mincore() to determine whether DB-pages are resident in memory.
◆ MDBX_USE_MINCORE_CONFIG
◆ MDBX_USE_OFDLOCKS
| #define MDBX_USE_OFDLOCKS 0 |
Advanced: Using POSIX OFD-locks (autodetection by default).
◆ MDBX_USE_SENDFILE
| #define MDBX_USE_SENDFILE 0 |
Advanced: Using sendfile() syscall (autodetection by default).
◆ MDBX_WITHOUT_MSVC_CRT
| #define MDBX_WITHOUT_MSVC_CRT 0 |
Avoid dependence from MSVC CRT and use ntdll.dll instead.