From 0de682819300f61988d211dabb91299306ab3c01 Mon Sep 17 00:00:00 2001 From: Eric Voskuil Date: Sat, 8 Aug 2026 15:47:41 -0400 Subject: [PATCH 1/3] Query volume space instead of reserving a probe file. --- .../database/impl/memory/mmap_private.ipp | 37 ++++++------------- 1 file changed, 11 insertions(+), 26 deletions(-) diff --git a/include/bitcoin/database/impl/memory/mmap_private.ipp b/include/bitcoin/database/impl/memory/mmap_private.ipp index 8d4046723..ad5cacc75 100644 --- a/include/bitcoin/database/impl/memory/mmap_private.ipp +++ b/include/bitcoin/database/impl/memory/mmap_private.ipp @@ -110,9 +110,9 @@ template bool CLASS::remap_all_(size_t capacity, std::index_sequence, bool final) NOEXCEPT { - // Probe the wave's disk requirement before touching any column file: a - // refused wave then retains no surplus provisioning (columns cannot be - // trimmed after a partial wave, as msc cannot shrink a mapped file). + // Probed before touching any column file: a refused wave then retains no + // surplus provisioning (a partial wave cannot be trimmed, as msc cannot + // shrink a mapped file). if (!probe_(capacity)) { if (final) @@ -377,9 +377,9 @@ bool CLASS::resize_(size_t size, bool final) NOEXCEPT } // The wave probe reserves the whole extension plus headroom on the store -// volume (column widths sum to the stride), released upon the grant: a -// refused wave touches no column file, and a granted one leaves the -// headroom unclaimed. +// volume (column widths sum to the stride) leaves the headroom unclaimed. +// An unmeasurable volume admits the wave: growth failure is the store's own +// disk full detection, and a query failure is not an exhaustion signal. TEMPLATE bool CLASS::probe_(size_t capacity) NOEXCEPT { @@ -387,29 +387,14 @@ bool CLASS::probe_(size_t capacity) NOEXCEPT const auto bytes = ceilinged_multiply( floored_subtract(capacity, file_.load()), stride); - if (is_zero(bytes)) + if (is_zero(bytes) || is_zero(headroom_)) return true; - auto name = filenames_.front(); - name += ".probe"; - auto probe = file::invalid; - if (file::create_file(name)) - probe = file::open(name); - - const auto reserve = ceilinged_add(bytes, headroom_); -#if !defined(WITHOUT_FALLOCATE) - const auto held = (probe != file::invalid) && - (::fallocate(probe, 0, zero, reserve) != fail); -#else - const auto held = (probe != file::invalid) && - (::ftruncate(probe, reserve) != fail); -#endif - - if (probe != file::invalid) - file::close(probe); + size_t available{}; + if (!file::space(available, filenames_.front())) + return true; - file::remove(name); - return held; + return available >= ceilinged_add(bytes, headroom_); } // Finalize failure results in unmapped. From 7c12148e8fbe13cd2117710aeeb549295462dc47 Mon Sep 17 00:00:00 2001 From: Eric Voskuil Date: Sat, 8 Aug 2026 16:11:43 -0400 Subject: [PATCH 2/3] Reduce size of vc++ debug TUs using OnlyExplicitInline. --- builds/msvc/properties/Debug.props | 3 +++ 1 file changed, 3 insertions(+) diff --git a/builds/msvc/properties/Debug.props b/builds/msvc/properties/Debug.props index d643eaa9d..1a54192f3 100644 --- a/builds/msvc/properties/Debug.props +++ b/builds/msvc/properties/Debug.props @@ -17,6 +17,9 @@ ProgramDatabase true true + + OnlyExplicitInline Disabled _DEBUG;%(PreprocessorDefinitions) From ac95cbdecd0d7fafa4b9ce2f0c4c5363eeb32391 Mon Sep 17 00:00:00 2001 From: Eric Voskuil Date: Sat, 8 Aug 2026 16:46:35 -0400 Subject: [PATCH 3/3] Build posix debug with -g1 vs -g (TU size). --- builds/cmake/CMakePresets.json | 4 ++-- builds/cmake/install-cmake.sh | 2 +- builds/cmake/install-presets.sh | 2 +- builds/gnu/install-gnu.sh | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/builds/cmake/CMakePresets.json b/builds/cmake/CMakePresets.json index ef8c3c193..e82d722ef 100644 --- a/builds/cmake/CMakePresets.json +++ b/builds/cmake/CMakePresets.json @@ -36,8 +36,8 @@ "hidden": true, "cacheVariables": { "CMAKE_BUILD_TYPE": "Debug", - "CMAKE_C_FLAGS": "$env{CMAKE_C_FLAGS} -Og -g --coverage -fprofile-update=atomic", - "CMAKE_CXX_FLAGS": "$env{CMAKE_CXX_FLAGS} -Og -g --coverage -fprofile-update=atomic" + "CMAKE_C_FLAGS": "$env{CMAKE_C_FLAGS} -Og -g1 --coverage -fprofile-update=atomic", + "CMAKE_CXX_FLAGS": "$env{CMAKE_CXX_FLAGS} -Og -g1 --coverage -fprofile-update=atomic" } }, { diff --git a/builds/cmake/install-cmake.sh b/builds/cmake/install-cmake.sh index 5a3c171a5..60d46fe14 100755 --- a/builds/cmake/install-cmake.sh +++ b/builds/cmake/install-cmake.sh @@ -343,7 +343,7 @@ main() msg_verbose "*** Build config specified, calculating flags..." if [[ "${BUILD_CONFIG}" == "debug" ]]; then - BUILD_FLAGS="-Og -g" + BUILD_FLAGS="-Og -g1" elif [[ "${BUILD_CONFIG}" == "release" ]]; then BUILD_FLAGS="-O3" fi diff --git a/builds/cmake/install-presets.sh b/builds/cmake/install-presets.sh index 3d5db2d08..3acc41f76 100755 --- a/builds/cmake/install-presets.sh +++ b/builds/cmake/install-presets.sh @@ -359,7 +359,7 @@ main() msg_verbose "*** Build config specified, calculating flags..." if [[ "${BUILD_CONFIG}" == "debug" ]]; then - BUILD_FLAGS="-Og -g" + BUILD_FLAGS="-Og -g1" elif [[ "${BUILD_CONFIG}" == "release" ]]; then BUILD_FLAGS="-O3" fi diff --git a/builds/gnu/install-gnu.sh b/builds/gnu/install-gnu.sh index 489d4c677..43b29dd99 100755 --- a/builds/gnu/install-gnu.sh +++ b/builds/gnu/install-gnu.sh @@ -345,7 +345,7 @@ main() msg_verbose "*** Build config specified, calculating flags..." if [[ "${BUILD_CONFIG}" == "debug" ]]; then - BUILD_FLAGS="-Og -g" + BUILD_FLAGS="-Og -g1" elif [[ "${BUILD_CONFIG}" == "release" ]]; then BUILD_FLAGS="-O3" fi