Skip to content

[29.x] Backports - #35234

Merged
fanquake merged 8 commits into
bitcoin:29.xfrom
fanquake:more_29_x_backports
Jun 3, 2026
Merged

fanquake merged 8 commits into
bitcoin:29.xfrom
fanquake:more_29_x_backports

Conversation

@fanquake fanquake added this to the 29.4 milestone May 7, 2026
@DrahtBot

DrahtBot commented May 7, 2026 •

Copy link
Copy Markdown
Contributor

The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.

Code Coverage & Benchmarks

For details see: https://corecheck.dev/bitcoin/bitcoin/pulls/35234.

Reviews

See the guideline for information on the review process.

Type Reviewers
ACK andrewtoth, marcofleon

If your review is incorrectly listed, please copy-paste <!--meta-tag:bot-skip--> into the comment that the bot should ignore.

LLM Linter (✨ experimental)

Possible places where named args for integral literals may be used (e.g. func(x, /*named_arg=*/0) in C++, and func(x, named_arg=0) in Python):

  • MaxInputWeight(*desc, CTxIn{outpoint}, coin_control, true, can_grind_r) in src/wallet/spend.cpp

2026-06-02 15:06:57

The FreeBSD, NetBSD, and OpenBSD build guides state that ZMQ support is compiled in when the package is installed. Since WITH_ZMQ defaults to OFF, update the wording to mention the required CMake option.

Github-Pull: bitcoin#35283
Rebased-From: ca93ab8
`CalculateMaximumSignedInputSize()` is passed the outpoint being sized, but that context was not used when estimating the signed input size.
Pass the outpoint through so externally selected inputs are not underestimated.

Co-authored-by: Antoine Poinsot <[email protected]>

Github-Pull: bitcoin#35228
Rebased-From: cd8d3bd
@fanquake
fanquake force-pushed the more_29_x_backports branch from b8b94d3 to 54edc2b Compare May 20, 2026 15:38
@fanquake
fanquake force-pushed the more_29_x_backports branch from 54edc2b to 6014ee2 Compare May 28, 2026 13:32
@fanquake fanquake mentioned this pull request May 28, 2026
@fanquake
fanquake force-pushed the more_29_x_backports branch from 6014ee2 to 0bc37f4 Compare May 29, 2026 08:48
@fanquake
fanquake force-pushed the more_29_x_backports branch from 0bc37f4 to be07b75 Compare May 29, 2026 14:34
@fanquake
fanquake marked this pull request as ready for review May 29, 2026 14:34
@fanquake fanquake mentioned this pull request May 29, 2026
@fanquake
fanquake force-pushed the more_29_x_backports branch 2 times, most recently from f600348 to 3031ebc Compare May 29, 2026 20:49
@andrewtoth

andrewtoth commented Jun 2, 2026 •

Copy link
Copy Markdown
Contributor

#34228 was backported here, but not mentioned in description or in that PR's comments. Likely an oversight?

Commit trailers for #34228 and for bitcoin-core/leveldb-subtree#61 are missing.

Lint fails due to not updating the leveldb subtree. I guess that's ok?

Also this comment in the 30.x backport PR applies here as well I believe #35232 (comment).

hebasto and others added 5 commits June 2, 2026 09:21
Seek compaction is causing a cascade effect in the chainstate DB, causing large parts of the database to be rewritten every ~hour.

Every periodic flush writes around 2 MiB. Since this is roughly the `write_buffer_size`, these writes regularly cause the memtable to rotate into a small L0 file. This file has a small seek budget, and with the random UTXO reads done during validation, it can get scheduled for seek compaction quickly.

That seek compaction pushes the small file down to L1. Since most UTXOs are already lower down in L4/L5, many reads that consult this file do not find the key there and continue downward. The bloom filter makes those misses cheap, but LevelDB still decrements the file's seek budget. The file then gets scheduled for another seek compaction, and the same pattern pushes it down through L2 and L3.

The expensive part happens around L3/L4. L4 has many ~32 MiB files holding the bulk of the UTXO set. When LevelDB compacts into L3, it may split the output into many smaller L3 files to limit how much L4 "grandparent" data any one output overlaps. Each of these small L3 files then gets its own small seek budget. Because chainstate keys are hash-random, each small L3 file can still have a broad key range, so many random reads consult it and quickly drain its budget. Once seek-compacted into L4, each tiny L3 file can overlap many L4 files, so compacting a few hundred KiB from L3 can require rewriting hundreds of MiB from L4. Repeating that across many small L3 files can rewrite most of the chainstate.

This is a poor fit for chainstate because UTXO keys are hash-random, the DB is large enough to have many levels, writes are relatively small and periodic, and reads are frequent. The result is that read misses trigger compactions much earlier than size pressure would, and those compactions have very high write amplification.

Disabling seek compaction may leave more files in upper levels for longer, so reads could theoretically consult more files. But Bitcoin Core enables bloom filters for all its LevelDB instances, so these misses are usually cheap in-memory filter checks rather than disk reads.

For the other DBs, the risk is much smaller. They also use bloom filters, and most are smaller and less read-heavy. With fewer levels and less random read pressure, disabling seek compaction should have little effect there.

Co-authored-by: l0rinc <[email protected]>

Github-Pull: bitcoin#35313
Rebased-From: 6bfdb6093bba4710d0f8313ed0113967a8b5176f
To match the usage of -latest for the warp runners.

Github-Pull: bitcoin#35408
Rebased-From: 5700a61
@fanquake
fanquake force-pushed the more_29_x_backports branch from 3031ebc to a7f22d1 Compare June 2, 2026 08:25
@fanquake

fanquake commented Jun 2, 2026

Copy link
Copy Markdown
Member Author

@andrewtoth thanks, should all be addressed.

@fanquake
fanquake force-pushed the more_29_x_backports branch from a7f22d1 to d8da418 Compare June 2, 2026 15:06

@andrewtoth andrewtoth left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ACK d8da418

@marcofleon marcofleon left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ACK d8da418

@fanquake
fanquake merged commit d476c28 into bitcoin:29.x Jun 3, 2026
18 of 19 checks passed
@fanquake
fanquake deleted the more_29_x_backports branch June 3, 2026 08:44
@fanquake fanquake mentioned this pull request Jun 3, 2026
sedited added a commit that referenced this pull request Jun 23, 2026
88cd3a7 doc: update manual pages for v29.4rc1 (fanquake)
116565b build: bump version to v29.4rc1 (fanquake)
d82afa9 doc: update release notes for v29.4rc1 (fanquake)
ea8fafd fuzz: Remove unused g_setup pointers (MarcoFalke)
1907b3f coins: compact chainstate in background (Lőrinc)
9dd8e32 validation: randomly compact chainstate (Lőrinc)
e0ab4cf coins: test chainstate flush baseline (Lőrinc)
53a5c7f lint: disable leveldb subtree check (fanquake)

Pull request description:

  Backports:
  * #35465

  Final changes for v`29.4rc1`.

  Backports since 29.3:
  * #34680
  * #34855
  * #35212
  * #35234

ACKs for top commit:
  sedited:
    ACK 88cd3a7

Tree-SHA512: 57d647f0baf124128d84072c3865cca72ca4a266e95f88b8e1313230aa70a25d76d372e042b095312325b57983805943179d46bfa898522303e90adb69c74347
tomt1664 added a commit to tomt1664/elements that referenced this pull request Jul 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants