Page MenuHomePhabricator

Add routine to upgrade the block tree db to index block size
ClosedPublic

Authored by deadalnix on Nov 8 2020, 01:33.

Details

Summary

This allows us to track the block size in the block index starting next version.

Pruning node will need to reindex.

The index upgrade is done in one batch as we don't expect the size of the batch to be absurdly big.

Depends on D8315 and D8318

Test Plan

Bump version to 0.22.8 by editing src/CMakeFiles.txt. Run the node on an already synced testnet folder. Check that it upgrades the bloc index on first launch, and do not do it again after that.

Run this on a prunned directory, and ensure it fails with an error message telling me to reindex.

Revert back to 0.22.7 and check that the node will not start due to an invalid version of the DB.

Diff Detail

Repository
rABC Bitcoin ABC
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

deadalnix edited the test plan for this revision. (Show Details)

Errors on invalid DB version.

deadalnix edited the test plan for this revision. (Show Details)

Do not upgrade entries that do not require upgrading.

Fabien requested changes to this revision.Nov 9 2020, 08:32
Fabien added a subscriber: Fabien.

More a question than requesting changes: comparing version against CLIENT_VERSION will force to upgrade the database at each version. This will read the disk content in the loop, but do nothing other than updating the version number in the end. Is there a use case for this or should version compare to TRACK_SIZE_VERSION instead ?

src/blockindex.h
69 ↗(On Diff #25557)

Typo: Siz => Size

src/txdb.cpp
533 ↗(On Diff #25557)

Typo: prunned => pruned

This revision now requires changes to proceed.Nov 9 2020, 08:32

More a question than requesting changes: comparing version against CLIENT_VERSION will force to upgrade the database at each version. This will read the disk content in the loop, but do nothing other than updating the version number in the end. Is there a use case for this or should version compare to TRACK_SIZE_VERSION instead ?

Yes. The upgrade while doing nothing is very quick, in fact, thee are several pices of code that go over the whole DB already, for instance, CBlockTreeDB::LoadBlockIndexGuts. This certainly can be tweaked further, but this is not a big deal, IMO.

This revision is now accepted and ready to land.Nov 9 2020, 19:00