Page MenuHomePhabricator

validation: indexing changes for assumeutxo
ClosedPublic

Authored by PiRK on Fri, Apr 4, 12:50.

Details

Reviewers
Fabien
Group Reviewers
Restricted Project
Commits
rABC963062a18938: validation: indexing changes for assumeutxo
Summary

When using an assumedvalid chainstate, only process validationinterface
callbacks from the background chainstate within indexes. This ensures
that all indexes are built in-order.

Later, we can possibly designate indexes which can be built out of order
and continue their operation during snapshot use.

Once the background sync has completed, restart the indexes so that
they continue to index the now-validated snapshot chainstate.

This is a partial backport of core#27596
https://github.com/bitcoin/bitcoin/pull/27596/commits/373cf91531b84bfdd06fdf8abf4dca228029ce6b

For now the support for chronik is minimal: the indexer only indexes the IBD chain and ignores the snapshot callbacks, so that everything is indexed in the right order. But when the background chain reaches the snapshot base, indexing will just stop and a node restart will be necessary for it to resume (then the chain are merged and there is no longer a snapshot chain).

Test Plan

ninja all check-all

Full IDB with assumeutxo and indexers enabled (except for Chronik)

Event Timeline

PiRK requested review of this revision.Fri, Apr 4, 12:50
Fabien requested changes to this revision.Mon, Apr 7, 09:32
Fabien added a subscriber: Fabien.
Fabien added inline comments.
src/index/base.cpp
83

you should move this code below and avoid the double cs_main lock

src/init.cpp
3070

Same here

This revision now requires changes to proceed.Mon, Apr 7, 09:32
src/init.cpp
3070

This instance would require duplicating the code in both the for loop and if branch below, as the lock is taken inside the loop.

avoid taking the lock twice in base.cpp

Fabien added inline comments.
src/init.cpp
3070

Is there a reason for releasing the lock at every loop increment ? Locking (especially cs_main) is generally slow

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