Page MenuHomePhabricator

blockstorage: segment normal/assumedvalid blockfiles
ClosedPublic

Authored by PiRK on Fri, Apr 4, 13:29.

Details

Reviewers
Fabien
Group Reviewers
Restricted Project
Commits
rABC5d870c3dab91: blockstorage: segment normal/assumedvalid blockfiles
Summary

When using an assumedvalid (snapshot) chainstate along with a background
chainstate, we are syncing two very different regions of the chain
simultaneously. If we use the same blockfile space for both of these
syncs, wildly different height blocks will be stored alongside one
another, making pruning ineffective.

This change implements a separate blockfile cursor for the assumedvalid
chainstate when one is in use.

This is a partial backport of core#27596 and core#28562
https://github.com/bitcoin/bitcoin/pull/27596/commits/7fcd21544a333ffdf1910b65c573579860be6a36
https://github.com/bitcoin/bitcoin/pull/28562/commits/82e48d20f1243fb7733e872a29661b151ab5d523
https://github.com/bitcoin/bitcoin/pull/28562/commits/a47fbe7d49e8921214ac159c558ff4ca19f98dce (partial)

Depends on D17895

Test Plan

ninja all check-all

Run a full IBD with assumeutxo and pruning.

Delete the datadir, build on master, run a few minutes of regular IBD to create an index. Fast-forward to this diff, re-compile and restart the node to check it can still load an existing datadir, check that the IBD resumes normally where we left them previously, without need to reindex. Stop and restart a second time. Stop and go back to master, re-compile, and check that the node still starts without any issue and without requiring a reindex.

Event Timeline

PiRK requested review of this revision.Fri, Apr 4, 13:29
PiRK planned changes to this revision.Fri, Apr 4, 13:37

there are some changes to be added from core#28562

PiRK edited the summary of this revision. (Show Details)

squash couple of commits from core#28562

Did you check for regression against an existing datadir ?

This revision is now accepted and ready to land.Mon, Apr 7, 11:39