Page MenuHomePhabricator

[Chronik] Wipe Chronik db when `-reindex` is set
ClosedPublic

Authored by tobias_ruck on Mar 13 2023, 21:33.

Details

Reviewers
Fabien
Group Reviewers
Restricted Project
Commits
rABCc6b762a3442f: [Chronik] Wipe Chronik db when `-reindex` is set
Summary

Currently, the only way of forcing Chronik to reindex is to delete the indexes/chronik folder. With this change, Chronik now respects -reindex, and uses RocksDB's DestroyDB function to wipe the DB cleanly.

Test Plan

ninja && ninja check-crates && ./test/functional/test_runner.py chronik_reindex

Diff Detail

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

Event Timeline

@bot build-linux64 build-linux-aarch64 build-linux-arm build-osx build-win64

Fabien requested changes to this revision.Mar 14 2023, 08:50
Fabien added inline comments.
test/functional/chronik_reindex.py
25 ↗(On Diff #38522)

This is duplicated from chronik_block.py.

Not in this diff, but it would be a good move to add a new Chronik python class to the test framework that can handle the requests.

42 ↗(On Diff #38522)

the extra args are not needed if untouched. You can leave it if you remove the params from the defaults

51 ↗(On Diff #38522)

You should merge this test and chronik_resync imo. This will let you factor out some code like this one, and this is mostly the same feature.

If you want to keep things clean, you can separate the cases into functions, like:

def run_tests(self):
    test_resync_happy_path()
    test_resync_corrupted_db()
    test_node_reindex()
    test_chronik_reindex()
    ...
55 ↗(On Diff #38522)

dito

This revision now requires changes to proceed.Mar 14 2023, 08:50

Merge chronik_reindex.py into chronik_resync.py

This revision is now accepted and ready to land.Mar 14 2023, 14:11