2 suggestions
Earlier concerns neither republished nor resolved: 2 minor findings · 2 suggestions. See the Run archive for their assessments.
Optional improvements
[suggestion] · Deferral warning understates the required free space
The warning omits the 50 MiB reserve, so near the threshold it can advertise enough space even though compaction remains deferred.
Location: src/validation.cpp:2841 (head).
Details and suggested fix
CheckDiskSpace(path, min_free_space) allows compaction only when available space is at least 50_MiB + min_free_space, but the warning reports only CeilDiv(min_free_space, 1_GiB) as needed. For example, on mainnet, a node with between 14 GiB and 14 GiB + 50 MiB free can see “14.03 GiB free, 14 GiB needed” while compaction is deferred. On regtest and custom-challenge signets, where the assumed size is zero, it can report “0.03 GiB free, 0 GiB needed.” Freeing the advertised amount may therefore leave compaction deferred. The warning also queries fs::space(path) again, so its free-space figure may differ from the value used for the decision; if the second query throws, only the generic “Failed to start chainstate compaction” message is logged. Query available space once, compare it with a required value that includes the reserve, and log that same value with enough precision.
[suggestion] · Zero assumed chainstate size leaves custom networks with only the 50 MiB reserve
On regtest and custom-challenge signets, the guard does not account for the actual coins database size; production impact on large local chainstates is unconfirmed.
Location: src/validation.cpp:2837 (head).
Details and suggested fix
The threshold uses AssumedChainStateSize() * 1_GiB, which is zero on regtest and custom-challenge signets. On those networks, CheckDiskSpace can allow automatic compaction with only its 50 MiB reserve free, regardless of the coins database size. A custom signet with a multi-GiB chainstate on a nearly full volume could therefore encounter the failure described in #36585: the disk fills and the next block write fails with “Disk space is too low!” The release note says compaction is deferred when free space is insufficient, but no deployed custom signet or regtest node with a large chainstate was identified, so how often this affects production is unconfirmed. This is not a regression because the base code had no disk-space check. One option is to use std::max(AssumedChainStateSize() * 1_GiB, CoinsDB().EstimateSize()); EstimateSize() approximates the coin key range and is already used for nDiskSize. The estimate includes obsolete data, so it may defer compaction more often on bloated databases. If that cost is unwanted, limit the release-note promise to networks with a nonzero assumed size.
Earlier concerns
Earlier reports raised these, with the titles and severities shown there. This review neither republished nor resolved them.
- [minor]: A failed space query skips compaction
- [suggestion]: Consider basing the warning on the current chainstate size
- [suggestion]: Distinguish free-space query failures from compaction-start failures
- [minor]: Compaction checks do not account for chainstates sharing a filesystem