Repository navigation
txospenderindex: disable bloom filters to optimize disk usage - #35568
Conversation
|
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers. Code Coverage & BenchmarksFor details see: https://corecheck.dev/bitcoin/bitcoin/pulls/35568. ReviewsSee the guideline and AI policy for information on the review process.
If your review is incorrectly listed, please copy-paste ConflictsReviewers, this pull request conflicts with the following ones:
If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first. |
4d701f9 to
74dfc8e
Compare
sedited
left a comment
There was a problem hiding this comment.
Nice find, ACK 74dfc8ec49c7bb480dac0c785cc2aae1a5e3ca30
l0rinc
left a comment
There was a problem hiding this comment.
Concept ACK, I'll test it myself and get back to you.
What happens when the user has an existing index, do they need to wait for compaction? Should we extend force_compact for these? Should we add a release notes for this?
74dfc8e to
b343c17
Compare
Yes, size compactions will remove the bloom filters as files are replaced.
I believe starting up with
I'm not sure an explicit release note is warranted. This could be covered under |
|
tested ACK I can reproduce the results, ~19% faster, ~5% smaller. benchmarkBEFORE="794befd4b06dcace1adbdb15e65bba1667f9bc15"; AFTER="74dfc8ec49c7bb480dac0c785cc2aae1a5e3ca30"; \
DATA_DIR="/mnt/my_storage/BitcoinData"; export DATA_DIR; \
LOG="${DATA_DIR}/debug.log"; export LOG; \
SIZE_LOG="${PWD}/txospenderindex-size.log"; export SIZE_LOG; : > "${SIZE_LOG}"; \
wait_index() { pid="$1"; while kill -0 "$pid" 2>/dev/null; do grep -q 'txospenderindex is enabled at height' "${LOG}" 2>/dev/null && return 0; sleep 5; done; grep -q 'txospenderindex is enabled at height' "${LOG}" 2>/dev/null; }; export -f wait_index; \
run_index() { label="$1"; daemon="$2"; shift 2; cli="${daemon%bitcoind}bitcoin-cli"; "$daemon" "$@" & pid=$!; if ! wait_index "$pid"; then wait "$pid" || true; echo "$label: bitcoind exited before txospenderindex was enabled" >&2; tail -100 "${LOG}" >&2 || true; return 1; fi; "$cli" -datadir="${DATA_DIR}" stop >/dev/null || kill "$pid" 2>/dev/null || true; wait "$pid" || true; sleep 10; du -sh "${DATA_DIR}/indexes/txospenderindex" | awk -v label="$label" '{print label " size: " $1}' >> "${SIZE_LOG}"; du -sb "${DATA_DIR}/indexes/txospenderindex" | awk -v label="$label" '{print label " bytes: " $1}' >> "${SIZE_LOG}"; }; export -f run_index; \
git reset --hard >/dev/null 2>&1 && git clean -fxd >/dev/null 2>&1 && git fetch origin $BEFORE $AFTER >/dev/null 2>&1; \
for c in $BEFORE:build-before $AFTER:build-after; do \
git checkout ${c%:*} >/dev/null 2>&1 && cmake -B ${c#*:} -G Ninja -DCMAKE_BUILD_TYPE=Release >/dev/null 2>&1 && ninja -C ${c#*:} bitcoind bitcoin-cli >/dev/null 2>&1; \
done; \
echo "txospenderindex bloom filter | $(hostname) | $(uname -m) | $(lscpu | grep 'Model name' | head -1 | cut -d: -f2 | xargs) | $(nproc) threads | $(free -h | awk '/^Mem:/{print $2}') RAM | $(df -T $DATA_DIR | awk 'NR==2{print $2}') | $(lsblk -no ROTA $(df --output=source $DATA_DIR | tail -1) | grep -q 1 && echo HDD || echo SSD)" && \
hyperfine --runs 1 --shell bash --sort command \
--prepare "rm -rf ${DATA_DIR}/indexes/* ${DATA_DIR}/debug.log" \
"run_index before ./build-before/bin/bitcoind -datadir=${DATA_DIR} -txospenderindex=1 -connect=0 -printtoconsole=0" \
"run_index after ./build-after/bin/bitcoind -datadir=${DATA_DIR} -txospenderindex=1 -connect=0 -printtoconsole=0"; \
echo "on-disk sizes:" && cat "${SIZE_LOG}"
before size: 88G forcecompactBEFORE="794befd4b06dcace1adbdb15e65bba1667f9bc15"; AFTER="74dfc8ec49c7bb480dac0c785cc2aae1a5e3ca30"; \
DATA_DIR="/mnt/my_storage/BitcoinData"; export DATA_DIR; \
LOG="${DATA_DIR}/debug.log"; export LOG; \
SIZE_LOG="${PWD}/txospenderindex-forcecompact-size.log"; export SIZE_LOG; : > "${SIZE_LOG}"; \
wait_log() { pattern="$1"; pid="$2"; while kill -0 "$pid" 2>/dev/null; do grep -Fq "$pattern" "${LOG}" 2>/dev/null && return 0; sleep 10; done; grep -Fq "$pattern" "${LOG}" 2>/dev/null; }; export -f wait_log; \
stop_node() { pid="$1"; cli="$2"; "$cli" -datadir="${DATA_DIR}" stop >/dev/null 2>&1 || kill "$pid" 2>/dev/null || true; wait "$pid" || true; sleep 10; }; export -f stop_node; \
record_size() { label="$1"; du -sh "${DATA_DIR}/indexes/txospenderindex" | awk -v label="$label" '{print label " size: " $1}' >> "${SIZE_LOG}"; du -sb "${DATA_DIR}/indexes/txospenderindex" | awk -v label="$label" '{print label " bytes: " $1}' >> "${SIZE_LOG}"; }; export -f record_size; \
git reset --hard >/dev/null 2>&1 && git clean -fxd >/dev/null 2>&1 && git fetch origin $BEFORE $AFTER >/dev/null 2>&1; \
for c in $BEFORE:build-before $AFTER:build-after; do \
git checkout ${c%:*} >/dev/null 2>&1 && cmake -B ${c#*:} -G Ninja -DCMAKE_BUILD_TYPE=Release >/dev/null 2>&1 && ninja -C ${c#*:} bitcoind bitcoin-cli >/dev/null 2>&1; \
done; \
echo "recreate old txospenderindex, then forcecompact new no-bloom txospenderindex"; \
rm -rf "${DATA_DIR}/indexes/txospenderindex" "${DATA_DIR}/debug.log"; \
./build-before/bin/bitcoind -datadir="${DATA_DIR}" -txospenderindex=1 -connect=0 -printtoconsole=0 & pid=$!; \
wait_log "txospenderindex is enabled at height" "$pid" && stop_node "$pid" "./build-before/bin/bitcoin-cli" && record_size "before old-rebuilt"; \
: > "${DATA_DIR}/debug.log"; \
./build-after/bin/bitcoind -datadir="${DATA_DIR}" -txospenderindex=1 -forcecompactdb=1 -connect=0 -printtoconsole=0 & pid=$!; \
wait_log "Finished database compaction of ${DATA_DIR}/indexes/txospenderindex/db" "$pid" && wait_log "txospenderindex is enabled at height" "$pid" && stop_node "$pid" "./build-after/bin/bitcoin-cli" && record_size "after new-forcecompact"; \
echo "on-disk sizes:" && cat "${SIZE_LOG}"
recreate old txospenderindex, then forcecompact new no-bloom txospenderindex
[1] 1435394
[1]+ Done ./build-before/bin/bitcoind -datadir="${DATA_DIR}" -txospenderindex=1 -connect=0 -printtoconsole=0
[1] 1451378
[1]+ Done ./build-after/bin/bitcoind -datadir="${DATA_DIR}" -txospenderindex=1 -forcecompactdb=1 -connect=0 -printtoconsole=0
before old-rebuilt size: 88G |
sedited
left a comment
There was a problem hiding this comment.
Re-ACK b343c17ee06c6357b564b05177f6060c4da81e70
|
Added #35634 to complement this change |
1134022 doc: add txospenderindex release note (Lőrinc) ce06878 index: shrink txospenderindex value markers (Lőrinc) Pull request description: **Problem:** `TxoSpenderIndex` values are never read: `FindSpender()` only uses the key, which already encodes the spender's disk position, but the values are written as single-byte `\0`(instead of empty values). **Fix:** Write zero-byte markers for new `txospenderindex` entries instead. Existing indexes stay readable because both formats use the same keys and the value is ignored. Rebuilding is only needed to shrink old entries. **Related work:** This complements #35568, which saves another ~4.5 GB by dropping bloom filters. A #35531-style rewrite could let existing indexes reclaim both savings without a full rebuild. **Reproducer:** Automated tests weren't added, but the manual reproducer below builds both commits, checks old/new format compatibility through `gettxspendingprevout`, and prints rebuilt index sizes. On my mainnet datadir this PR shrank `txospenderindex` by ~3.4 GB (from 89G to 86G). <details><summary>Script + sample output</summary> ```bash BEFORE="89b4000ae06c72c5a14ee05ad70d3aece3f1b382" AFTER="1be799ef858c33158a302857b084e169b5bf8c1f" DATA_DIR="/mnt/my_storage/BitcoinData" LOG="${DATA_DIR}/debug.log" OUT='[{"txid":"0437cd7f8525ceed2324359c2d0ba26006d92d856a9c20fa0241106ee5a597c9","vout":0}]' SPEND="f4184fc596403b9d638783cf57adfe4c75c605f6356fbc91338530e9831e9e16"; \ for b in before after; do [ -x ./build-$b/bin/bitcoin-cli ] && ./build-$b/bin/bitcoin-cli -datadir="${DATA_DIR}" stop >/dev/null 2>&1 || true; done; sleep 10; \ git reset --hard >/dev/null 2>&1 && git clean -fxd >/dev/null 2>&1 && (git fetch origin "$BEFORE" "$AFTER" >/dev/null 2>&1 || true) && \ for c in before:$BEFORE after:$AFTER; do git checkout ${c#*:} >/dev/null 2>&1 && cmake -B build-${c%:*} -DCMAKE_BUILD_TYPE=Release >/dev/null 2>&1 && cmake --build build-${c%:*} -j --target bitcoind bitcoin-cli >/dev/null 2>&1; done && \ for b in before after; do ./build-$b/bin/bitcoin-cli -datadir="${DATA_DIR}" stop >/dev/null 2>&1 || true; done; sleep 10; \ start_node() { [ "$2" = wipe ] && rm -rf "${DATA_DIR}/indexes/txospenderindex" "${LOG}"; : > "${LOG}"; ./build-"$1"/bin/bitcoind -datadir="${DATA_DIR}" -txospenderindex=1 -connect=0 -printtoconsole=0 & pid=$!; while ! grep -Fq 'txospenderindex is enabled at height' "${LOG}" 2>/dev/null; do kill -0 "$pid" 2>/dev/null || { tail -100 "${LOG}"; return 1; }; sleep 5; done; }; \ check_spend() { result="$(./build-"$1"/bin/bitcoin-cli -datadir="${DATA_DIR}" gettxspendingprevout "$OUT" '{"mempool_only":false}')"; echo "$2: $result"; echo "$result" | grep -q "$SPEND"; }; \ stop_node() { ./build-"$1"/bin/bitcoin-cli -datadir="${DATA_DIR}" stop >/dev/null; wait "$pid"; }; \ echo "prevout: 0437cd7f8525ceed2324359c2d0ba26006d92d856a9c20fa0241106ee5a597c9:0 -> ${SPEND}" && \ start_node before wipe && check_spend before "old binary reads old-format index" && du -sh "${DATA_DIR}/indexes/txospenderindex"; stop_node before && \ start_node after && check_spend after "new binary reads old-format index"; stop_node after && \ start_node after wipe && check_spend after "new binary reads new-format index" && du -sh "${DATA_DIR}/indexes/txospenderindex"; stop_node after && \ start_node before && check_spend before "old binary reads new-format index"; stop_node before ``` Expected result, trimmed to the relevant compatibility and size lines: ```text prevout: 0437cd7f8525ceed2324359c2d0ba26006d92d856a9c20fa0241106ee5a597c9:0 -> f4184fc596403b9d638783cf57adfe4c75c605f6356fbc91338530e9831e9e16 old binary reads old-format index: [ ... "spendingtxid": "f4184fc596403b9d638783cf57adfe4c75c605f6356fbc91338530e9831e9e16" ... ] 89G /mnt/my_storage/BitcoinData/indexes/txospenderindex new binary reads old-format index: [ ... "spendingtxid": "f4184fc596403b9d638783cf57adfe4c75c605f6356fbc91338530e9831e9e16" ... ] new binary reads new-format index: [ ... "spendingtxid": "f4184fc596403b9d638783cf57adfe4c75c605f6356fbc91338530e9831e9e16" ... ] 86G /mnt/my_storage/BitcoinData/indexes/txospenderindex old binary reads new-format index: [ ... "spendingtxid": "f4184fc596403b9d638783cf57adfe4c75c605f6356fbc91338530e9831e9e16" ... ] ``` </details> ACKs for top commit: davidgumberg: crACK 1134022 sedited: ACK 1134022 ekzyis: utACK 1134022 andrewtoth: ACK 1134022 Tree-SHA512: 07945b9470670115e27a1ef51e64164da7b91e550fdcb59952bfc98d862264b405e8fd8c3267c42718a39823f853057390d031d936d6e0b2172ec07e36cfdd67
|
Can you add this to #35634's release note? |
LevelDB bloom filters are only consulted on Get point reads. They are not consulted for iterator seeks. txospenderindex only reads via iterator seeks, so building them is wasted effort and space.
b343c17 to
6d0ea4c
Compare
|
Rebased for #35634. |
|
ACK 6d0ea4c (the PR description needs updated numbers now) |
| //! If true, store data obfuscated via simple XOR. If false, XOR with a | ||
| //! zero'd byte array. | ||
| bool obfuscate = false; | ||
| //! If true, build a LevelDB bloom filter to accelerate point lookups. |
There was a problem hiding this comment.
micro-nit: Could have added a bit more info on the trade-offs involved here.
|
@andrewtoth can you update the numbers in the description? This is rfm otherwise. |
|
@sedited Sorry I won't be able to re-measure until early next week. |
…o optimize disk usage 985179c doc: add release notes (Andrew Toth) 365d8aa txospenderindex: disable bloom filters to optimize disk usage (Andrew Toth) Pull request description: LevelDB bloom filters are only consulted on `Get` point reads. This can be verified in https://github.com/bitcoin/bitcoin/blob/master/src/leveldb/table/table.cc#L224-L228. `InternalGet` is the only place that consults the filter, and it is only reached via a `Get` or `Exists` point read. The filters are never consulted for iterator seeks with an iterator created via `NewIterator`. txospenderindex only reads via iterator seeks, so building them is wasted effort and space. For a db as large as txospenderindex, this results in measurable performance and disk usage. On master, a full sync took 4h37m, and the resulting db was 85.0 GiB. On this branch, a full sync took 3h57m, and the resulting db was 80.9 GiB. So this is a sync speedup of 39 minutes (1.17x), and a disk space reduction of 4.2 GiB. ACKs for top commit: l0rinc: ACK 985179c sedited: Re-ACK 985179c fjahr: Code review ACK 985179c Tree-SHA512: fb88b9f9a16ff31562d388e3fd9fd9590c7864dbe6093cd9430ecbce9cdc3f2a8d3fc612aade743d26ad4c6eca1e5dc9b3f1ca28d75caea1209e5c784895405d
…4e48e968a 114e48e968a kernel: Add script tracer 54e1a95a12e Merge bitcoin/bitcoin#35719: ci: disable Qt build in OpenBSD cross job b0e09511586 ci: disable Qt build in OpenBSD cross job 734c34bafda Merge bitcoin/bitcoin#35427: depends: Build `qt` and `qrencode` packages on OpenBSD ee61b11a9e7 Merge bitcoin/bitcoin#35200: node: smooth oversized `dbcache` warnings e3554bf361f Merge bitcoin/bitcoin#35579: wallet: reserve walletrescan before checking wallet is at the tip 11ae4265522 Merge bitcoin/bitcoin#35715: cmake: Fix WITH_EXTERNAL_LIBMULTIPROCESS + BUILD_FUZZ_BINARY e544413c0de Merge bitcoin/bitcoin#32763: wallet: Replace CWalletTx::mapValue and vOrderForm with explicit class members fe1cb6e40d7 Merge bitcoin/bitcoin#35690: wallet: Introduce WalletError with machine-readable error code 441f3114f57 Merge bitcoin/bitcoin#35659: Clarify supported *BSD releases and drop outdated workarounds 0399df827c6 Merge bitcoin/bitcoin#35708: depends: capnp 1.5.0 1ab1fdd4696 Merge bitcoin/bitcoin#35705: bench: replace CreateMockableWalletDatabase with MakeInMemoryWalletDatabase db35b9238fc ipc # build: Fix fuzz target CMakeLists.txt for external libmultiprocess d18fec892e2 Merge bitcoin/bitcoin#35698: doc: Update enum class constant naming style guide a2e4cd7ad2a depends: capnp 1.5.0 7508ac319d9 bench: replace CreateMockableWalletDatabase with MakeInMemoryWalletDatabase 907e284e303 Merge bitcoin/bitcoin#35701: test: Remove `mock_process.cpp` c8459b6bdcd Merge bitcoin/bitcoin#35568: txospenderindex: disable bloom filters to optimize disk usage 63c5f9d22c0 test: Remove `mock_process.cpp` ef101b04a8d Merge bitcoin/bitcoin#35655: wallet: Use in-memory SQLite for temporary wallet in exportwatchonlywallet b6becf3534c Merge bitcoin/bitcoin#35684: Update libmultiprocess subtree to add `max_connections` option 930f25050f7 Merge bitcoin/bitcoin#35700: doc: archive release notes for v29.4 9b2b3f4ec6f doc: archive release notes for v29.4 297fd1489bb Merge bitcoin/bitcoin#35412: ci: add NetBSD Clang cross job e314869066b Merge bitcoin/bitcoin#35695: Remove myself as security contact e3d67a5eae5 Merge bitcoin/bitcoin#35691: chainparams: delete my DNS seed a8223bb4e62 wallet: Introduce WalletError with machine-readable error code fad5809cb92 doc: Update enum class constant naming style guide 7d8137c1417 Merge bitcoin/bitcoin#34897: indexes: Don't commit ahead of the flushed chainstate 629df81e4c6 Remove myself as security contact d164a043426 node: smooth oversized `-dbcache` warnings d9080639804 chainparams: delete my DNS seed e9ed898a0da validation: Don't use m_chain.Tip() in FlushStateToDisk 3679f1ecf5e index: Don't commit ahead of the flushed chainstate 65735728a5a index: Remove return value from Commit() 09c06960c6a validation: track last flushed block 13c02b5466d test: add test for index commits ahead of the last flushed block c43b7a1115f ci: add netBSD cross CI job 699c21aea47 depends: add netbsd_LDFLAGS 777d23f25c7 test: add regression test for in-memory SQLiteDatabase reopen d1e7f8c986f wallet: use in-memory SQLite for temporary wallet in exportwatchonlywallet ee43743f126 wallet: store m_additional_flags in SQLiteDatabase to fix reopen path a9d1b652f32 Merge commit '707d0ded84563386f770ec17970834c65f8fa938' into pr/subtree-12 707d0ded845 Squashed 'src/ipc/libmultiprocess/' changes from 16bf05dea02..28e056576a3 2bab6bc73f2 refactor: Drop support for FreeBSD < 14 91b5c8a07c6 refactor: Remove FreeBSD-specific workaround 56701ff6d5c doc: Clarify supported *BSD releases 6d0ea4cf5bd doc: add release notes a2b1c86903a txospenderindex: disable bloom filters to optimize disk usage fed3cf6f0ed wallet: Replace CWalletTx's vOrderForm with specific fields 4f8823e8e11 wallet: Drop vOrderForm from CommitTransaction 9e62e4b1f34 test: slow down rescaning process a2b0bfcd854 wallet: Drop mapValue from CWalletTx cb99864c91c wallet: Throw if unknown entry is found in mapValue 98d5cdae663 wallet: Make CWalletTx "replaces_txid" and "replaced_by_txid" member variables 7ef8a6efc2a wallet: Make CWalletTx "comment" and "to" member variables 2155e913d3e wallet: Make CWalletTx "from" and "message" member variables c6ba98dcc8a wallet: Drop mapValue from CommitTransaction 00abb174a80 wallet: Pass comment and comment_to to CommitTransaction 1a219a37a21 wallet: Pass replaces_txid to CommitTransaction outside of mapValue 336f5a738b3 wallet: reserve walletrescan before checking wallet is at the tip a54ec373a69 depends: Build `qt` and `qrencode` packages for OpenBSD hosts git-subtree-dir: libbitcoinkernel-sys/bitcoin git-subtree-split: 114e48e968a087f74c1ab611ac2a31a9266812e1
…d9ec7f3d4 70d9ec7f3d4 Merge bitcoin/bitcoin#34538: net: advertise -externalip addresses 7bff765d514 Merge bitcoin/bitcoin#35639: external_signer: validate fingerprint from enumerate response 773b1c9aa58 Merge bitcoin/bitcoin#35572: coins: make cursor iteration DB-only 8d9e4f8dbd8 Merge bitcoin/bitcoin#35633: wallet: avoid call bumpfeediscount with negative values c4216e885a6 Merge bitcoin/bitcoin#35723: fuzz: Drop unnecessary mutexes 240d5f743aa fuzz: Drop unnecessary mutexes cf0368fb76e Merge bitcoin/bitcoin#35720: ipc: Update libmultiprocess subtree and drop fuzz test workaround 2d4065d1fe4 Merge bitcoin/bitcoin#35718: ci: Update lint container dependencies 8d9fbf76664 Merge bitcoin/bitcoin#35380: kernel: expose witness stack and scriptSig for btck_TransactionInput fab8eeed82c fuzz: clang-format LIMITED_WHILE fa0d777ce2a fuzz: Clang-format LIMITED_WHILE like while fa1a9bde5a6 fuzz: Remove unused workaround after fix in libmultiprocess byte-span serializer fa55385ab36 fuzz: Use LIMITED_WHILE over for-loop with consumed size integral fa911d815db Merge commit '6d5f753921578eefdd3fce64cfc8ee7951b6cbc4' into HEAD 6d5f7539215 Squashed 'src/ipc/libmultiprocess/' changes from 28e056576a..e8de5c7b68 900a7785bf5 ci: use Ubuntu 26.04 for lint container 058a73a0aea ci: use uv 11.x 14f4ddcb554 ci: mypy 2.3.0 54e1a95a12e Merge bitcoin/bitcoin#35719: ci: disable Qt build in OpenBSD cross job b0e09511586 ci: disable Qt build in OpenBSD cross job 734c34bafda Merge bitcoin/bitcoin#35427: depends: Build `qt` and `qrencode` packages on OpenBSD ee61b11a9e7 Merge bitcoin/bitcoin#35200: node: smooth oversized `dbcache` warnings e3554bf361f Merge bitcoin/bitcoin#35579: wallet: reserve walletrescan before checking wallet is at the tip 11ae4265522 Merge bitcoin/bitcoin#35715: cmake: Fix WITH_EXTERNAL_LIBMULTIPROCESS + BUILD_FUZZ_BINARY e544413c0de Merge bitcoin/bitcoin#32763: wallet: Replace CWalletTx::mapValue and vOrderForm with explicit class members fe1cb6e40d7 Merge bitcoin/bitcoin#35690: wallet: Introduce WalletError with machine-readable error code 441f3114f57 Merge bitcoin/bitcoin#35659: Clarify supported *BSD releases and drop outdated workarounds 0399df827c6 Merge bitcoin/bitcoin#35708: depends: capnp 1.5.0 1ab1fdd4696 Merge bitcoin/bitcoin#35705: bench: replace CreateMockableWalletDatabase with MakeInMemoryWalletDatabase db35b9238fc ipc # build: Fix fuzz target CMakeLists.txt for external libmultiprocess d18fec892e2 Merge bitcoin/bitcoin#35698: doc: Update enum class constant naming style guide a2e4cd7ad2a depends: capnp 1.5.0 7508ac319d9 bench: replace CreateMockableWalletDatabase with MakeInMemoryWalletDatabase 907e284e303 Merge bitcoin/bitcoin#35701: test: Remove `mock_process.cpp` c8459b6bdcd Merge bitcoin/bitcoin#35568: txospenderindex: disable bloom filters to optimize disk usage 63c5f9d22c0 test: Remove `mock_process.cpp` ef101b04a8d Merge bitcoin/bitcoin#35655: wallet: Use in-memory SQLite for temporary wallet in exportwatchonlywallet b6becf3534c Merge bitcoin/bitcoin#35684: Update libmultiprocess subtree to add `max_connections` option 930f25050f7 Merge bitcoin/bitcoin#35700: doc: archive release notes for v29.4 9b2b3f4ec6f doc: archive release notes for v29.4 297fd1489bb Merge bitcoin/bitcoin#35412: ci: add NetBSD Clang cross job e314869066b Merge bitcoin/bitcoin#35695: Remove myself as security contact e3d67a5eae5 Merge bitcoin/bitcoin#35691: chainparams: delete my DNS seed a8223bb4e62 wallet: Introduce WalletError with machine-readable error code fad5809cb92 doc: Update enum class constant naming style guide 7d8137c1417 Merge bitcoin/bitcoin#34897: indexes: Don't commit ahead of the flushed chainstate 629df81e4c6 Remove myself as security contact d164a043426 node: smooth oversized `-dbcache` warnings d9080639804 chainparams: delete my DNS seed e9ed898a0da validation: Don't use m_chain.Tip() in FlushStateToDisk 3679f1ecf5e index: Don't commit ahead of the flushed chainstate 65735728a5a index: Remove return value from Commit() 09c06960c6a validation: track last flushed block 13c02b5466d test: add test for index commits ahead of the last flushed block c43b7a1115f ci: add netBSD cross CI job 699c21aea47 depends: add netbsd_LDFLAGS 777d23f25c7 test: add regression test for in-memory SQLiteDatabase reopen d1e7f8c986f wallet: use in-memory SQLite for temporary wallet in exportwatchonlywallet ee43743f126 wallet: store m_additional_flags in SQLiteDatabase to fix reopen path a9d1b652f32 Merge commit '707d0ded84563386f770ec17970834c65f8fa938' into pr/subtree-12 707d0ded845 Squashed 'src/ipc/libmultiprocess/' changes from 16bf05dea02..28e056576a3 6667dc4eec7 kernel: expose scriptSig for btck_TransactionInput e6de3a2d3c7 kernel: expose witness stack for btck_TransactionInput 3ae3a94f2bd wallet: avoid call bumpfeediscount with negative values dab7f2c984b test: cover -externalip/onlynet interaction in functional test 657a5aa3f3d test: cover -externalip bypassing -onlynet 8c87e32bd39 net: let -externalip bypass -onlynet f4af02e827b net: add an add_even_if_unreachable argument to AddLocal 2bab6bc73f2 refactor: Drop support for FreeBSD < 14 91b5c8a07c6 refactor: Remove FreeBSD-specific workaround 56701ff6d5c doc: Clarify supported *BSD releases 6d0ea4cf5bd doc: add release notes a2b1c86903a txospenderindex: disable bloom filters to optimize disk usage 4c9de7d5b32 external_signer: validate fingerprint from enumerate response fed3cf6f0ed wallet: Replace CWalletTx's vOrderForm with specific fields 4f8823e8e11 wallet: Drop vOrderForm from CommitTransaction 9e62e4b1f34 test: slow down rescaning process a2b0bfcd854 wallet: Drop mapValue from CWalletTx cb99864c91c wallet: Throw if unknown entry is found in mapValue 98d5cdae663 wallet: Make CWalletTx "replaces_txid" and "replaced_by_txid" member variables 7ef8a6efc2a wallet: Make CWalletTx "comment" and "to" member variables 2155e913d3e wallet: Make CWalletTx "from" and "message" member variables c6ba98dcc8a wallet: Drop mapValue from CommitTransaction 00abb174a80 wallet: Pass comment and comment_to to CommitTransaction 1a219a37a21 wallet: Pass replaces_txid to CommitTransaction outside of mapValue 72db4accbf5 coins: drop stale cursor null checks 3d2f2d8de09 coins: pass UTXO stats view by reference 35aedb28236 coins: drop cursor from base view c6fbe2f66cf coins: pass DB view to cursor users 336f5a738b3 wallet: reserve walletrescan before checking wallet is at the tip a54ec373a69 depends: Build `qt` and `qrencode` packages for OpenBSD hosts git-subtree-dir: libbitcoinkernel-sys/bitcoin git-subtree-split: 70d9ec7f3d452789d04dce81dc02db0b3b778bb5
…o optimize disk usage 6d0ea4cf5bdc97331d4550a35d361a7d13d259a4 doc: add release notes (Andrew Toth) a2b1c86903ab37000c145817b8d226fb218b663f txospenderindex: disable bloom filters to optimize disk usage (Andrew Toth) Pull request description: LevelDB bloom filters are only consulted on `Get` point reads. This can be verified in https://github.com/bitcoin/bitcoin/blob/master/src/leveldb/table/table.cc#L224-L228. `InternalGet` is the only place that consults the filter, and it is only reached via a `Get` or `Exists` point read. The filters are never consulted for iterator seeks with an iterator created via `NewIterator`. txospenderindex only reads via iterator seeks, so building them is wasted effort and space. For a db as large as txospenderindex, this results in measurable performance and disk usage. On master, a full sync took 4h37m, and the resulting db was 85.0 GiB. On this branch, a full sync took 3h57m, and the resulting db was 80.9 GiB. So this is a sync speedup of 39 minutes (1.17x), and a disk space reduction of 4.2 GiB. ACKs for top commit: l0rinc: ACK 6d0ea4cf5bdc97331d4550a35d361a7d13d259a4 sedited: Re-ACK 6d0ea4cf5bdc97331d4550a35d361a7d13d259a4 fjahr: Code review ACK 6d0ea4cf5bdc97331d4550a35d361a7d13d259a4 Tree-SHA512: fb88b9f9a16ff31562d388e3fd9fd9590c7864dbe6093cd9430ecbce9cdc3f2a8d3fc612aade743d26ad4c6eca1e5dc9b3f1ca28d75caea1209e5c784895405d

LevelDB bloom filters are only consulted on
Getpoint reads. This can be verified in https://github.com/bitcoin/bitcoin/blob/master/src/leveldb/table/table.cc#L224-L228.InternalGetis the only place that consults the filter, and it is only reached via aGetorExistspoint read. The filters are never consulted for iterator seeks with an iterator created viaNewIterator.txospenderindex only reads via iterator seeks, so building them is wasted effort and space.
For a db as large as txospenderindex, this results in measurable performance and disk usage.
On master, a full sync took 4h37m, and the resulting db was 85.0 GiB.
On this branch, a full sync took 3h57m, and the resulting db was 80.9 GiB.
So this is a sync speedup of 39 minutes (1.17x), and a disk space reduction of 4.2 GiB.