#36292 index: Delete old coinstats index directory on startup

ReviewabilityReviewsAgreementSize
#36292 fjahr index: Delete old coinstats index directory on startupReady1Positive14 + 2 tests
  • Automatically delete the obsolete coinstats index directory on startup
  • Reclaims disk space on nodes upgraded from older releases
  • Ready to review
  • Nothing known that would invalidate a review
  • Concept approval without stated reasons (mzumsande)
  • Approval without stated reasons (sedited)
  • 14 lines added or modified outside tests
  • 2 lines added or modified in tests
  • 6 lines removed in total
  • 3 files, 2 commits
Indexes#10 of 11
P3 · cleanup
  • P3 because it reclaims wasted disk space from obsolete data on upgraded nodes
  • Provides routine housekeeping without affecting index correctness or performance
Reviewability: ReadyStalePaused
Agreement: StrongPositivePositive w/ caveatsNeutralMildDisputedBlockedCrickets
Reviews: current code-review ACKs, then (+stale ACKs) and -NACKs; greener = more ACKs.
Size: lines added or modified outside tests, then in tests; greener = smaller.

Goal

Deletes the obsolete `indexes/coinstats` database directory automatically on startup when `-coinstatsindex` is enabled. The old directory was left intact in v30 to allow nodes to downgrade to v29 without having to rebuild the index. With v29 reaching end-of-life, the database is now destroyed and removed if found.

Problem: Nodes upgraded from v29 or earlier retain the legacy `indexes/coinstats` directory indefinitely unless manually deleted, wasting disk space even though the active index resides in `indexes/coinstatsindex`.

Evidence of importance:

  • A code comment in `coinstatsindex.cpp` scheduled this cleanup: '// TODO: Change this to deleting the old index with v31.'
  • PR description: 'coinstatsindex was updated in an incompatible way in v30 (see #30469) and moved to the indexes/coinstatsindex folder... Since v32 branch-off has happened, this would now ship in v33. By then 29.x should be EOL assuming we are not going to release a v29.5.'

Reviewability

Ready

Nothing known that would invalidate a review now.

Waiting on (from the thread read):

  • nothing: no pending requests or open questions

Agreement

Positive

support without stated reasons, no open objection (mzumsande, sedited)

Thread notes: bartoli asked whether deleting the old index before creating the new one was risky; fjahr clarified that the new index does not rely on the old data, answering the question.

Objections, suggestions, and questions: none recorded.

Support:

  • mzumsande (member) (Concept ACK, 2026-09-17): (no reason given) [not substantive]
  • sedited (member) (ACK, 2026-09-18): (no reason given) [not substantive]

Participants:

  • mzumsande (member, support, 1 statements 2026-09-17 to 2026-09-17): Concept ACK
  • sedited (member, support, 1 statements 2026-09-18 to 2026-09-18): ACK
  • bartoli (none, question, 1 statements 2026-09-23 to 2026-09-23): asked whether deleting the old index directory before creating the new one was risky

Files

3 lines under test/bench/ci.

  • src/index/coinstatsindex.cpp +7/-5
  • doc/release-notes-coinstatsindex-cleanup.md +7/-0
  • test/functional/feature_coinstatsindex_compatibility.py +2/-1

Card

The short text the ranking pass compares across PRs.

Automatically deletes the obsolete legacy coinstats index directory at indexes/coinstats on startup when -coinstatsindex is enabled. A format migration in v30 moved the active index to indexes/coinstatsindex while retaining the old folder to support downgrades to v29. With v29 reaching end-of-life, this scheduled cleanup reclaims disk space for users who had upgraded from older releases.

Data

dossier JSON · extract JSON · model ledger, generated 2026-09-24T01:20, confidence high, input hash 01d0457bc393021b
thread read through 2026-09-23 (4 statements), head 82e4cc6964
Discussion read under schema 1 rules: suggestions and questions may be missing, and an objection may combine several harms (schema history).
labels: UTXO Db and Indexes

Categories

Indexes

P3 · cleanup

Automatically cleans up the legacy v29 `indexes/coinstats` directory to reclaim wasted disk space on upgraded nodes now that v29 is EOL. Resolves an explicit TODO scheduled for post-v29 lifecycle, providing useful housekeeping without affecting core index correctness or performance.

Membership: Modifies `src/index/coinstatsindex.cpp` and index functional tests.

Factors: security/stability 0, bug 0, performance 0, user value 1, leverage 0