-
Notifications
You must be signed in to change notification settings - Fork 368
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(cli): add shard
CLI command
#1785
Conversation
40cc4ce
to
3afbe05
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good so far 😃 just some small suggestions for improvements. Would also be nice if there are tests to check verify the state is pruned as expected, but could be done in a followup
progress := "rolling back blockstore & cometbft state to height %d" | ||
numChars := len(fmt.Sprintf(progress, latest)) | ||
clearLine := fmt.Sprintf("\r%s\r", strings.Repeat(" ", numChars)) | ||
printRollbackProgress := func(h int64) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The progress output is great for long running tasks 😃
1e0e9c9
to
c07e5a5
Compare
2f11c5f
to
6632cf9
Compare
* stub out shard CLI command * prune blocks before and after desired range * update rollback to use patched cometbft * temp override for local patched versions * handle pruning cometbft & block store state * include docs & support -1 for "latest" * update changelog * add --only-app-state flag to match cosmos-sdk prune cmd * give -1 magic number a name & reuse home from ctx * refactor to only open state.db & blockstore.db once * write rollback progress to one line * prevent attempting rollback of future blocks * make shard inclusive of endblock * use tagged cosmo-sdk & cometbft versions
6632cf9
to
e20e74c
Compare
* stub out shard CLI command * prune blocks before and after desired range * update rollback to use patched cometbft * temp override for local patched versions * handle pruning cometbft & block store state * include docs & support -1 for "latest" * update changelog * add --only-app-state flag to match cosmos-sdk prune cmd * give -1 magic number a name & reuse home from ctx * refactor to only open state.db & blockstore.db once * write rollback progress to one line * prevent attempting rollback of future blocks * make shard inclusive of endblock * use tagged cosmo-sdk & cometbft versions
* stub out shard CLI command * prune blocks before and after desired range * update rollback to use patched cometbft * temp override for local patched versions * handle pruning cometbft & block store state * include docs & support -1 for "latest" * update changelog * add --only-app-state flag to match cosmos-sdk prune cmd * give -1 magic number a name & reuse home from ctx * refactor to only open state.db & blockstore.db once * write rollback progress to one line * prevent attempting rollback of future blocks * make shard inclusive of endblock * use tagged cosmo-sdk & cometbft versions
* stub out shard CLI command * prune blocks before and after desired range * update rollback to use patched cometbft * temp override for local patched versions * handle pruning cometbft & block store state * include docs & support -1 for "latest" * update changelog * add --only-app-state flag to match cosmos-sdk prune cmd * give -1 magic number a name & reuse home from ctx * refactor to only open state.db & blockstore.db once * write rollback progress to one line * prevent attempting rollback of future blocks * make shard inclusive of endblock * use tagged cosmo-sdk & cometbft versions
* stub out shard CLI command * prune blocks before and after desired range * update rollback to use patched cometbft * temp override for local patched versions * handle pruning cometbft & block store state * include docs & support -1 for "latest" * update changelog * add --only-app-state flag to match cosmos-sdk prune cmd * give -1 magic number a name & reuse home from ctx * refactor to only open state.db & blockstore.db once * write rollback progress to one line * prevent attempting rollback of future blocks * make shard inclusive of endblock * use tagged cosmo-sdk & cometbft versions
* stub out shard CLI command * prune blocks before and after desired range * update rollback to use patched cometbft * temp override for local patched versions * handle pruning cometbft & block store state * include docs & support -1 for "latest" * update changelog * add --only-app-state flag to match cosmos-sdk prune cmd * give -1 magic number a name & reuse home from ctx * refactor to only open state.db & blockstore.db once * write rollback progress to one line * prevent attempting rollback of future blocks * make shard inclusive of endblock * use tagged cosmo-sdk & cometbft versions
* stub out shard CLI command * prune blocks before and after desired range * update rollback to use patched cometbft * temp override for local patched versions * handle pruning cometbft & block store state * include docs & support -1 for "latest" * update changelog * add --only-app-state flag to match cosmos-sdk prune cmd * give -1 magic number a name & reuse home from ctx * refactor to only open state.db & blockstore.db once * write rollback progress to one line * prevent attempting rollback of future blocks * make shard inclusive of endblock * use tagged cosmo-sdk & cometbft versions
* stub out shard CLI command * prune blocks before and after desired range * update rollback to use patched cometbft * temp override for local patched versions * handle pruning cometbft & block store state * include docs & support -1 for "latest" * update changelog * add --only-app-state flag to match cosmos-sdk prune cmd * give -1 magic number a name & reuse home from ctx * refactor to only open state.db & blockstore.db once * write rollback progress to one line * prevent attempting rollback of future blocks * make shard inclusive of endblock * use tagged cosmo-sdk & cometbft versions
* stub out shard CLI command * prune blocks before and after desired range * update rollback to use patched cometbft * temp override for local patched versions * handle pruning cometbft & block store state * include docs & support -1 for "latest" * update changelog * add --only-app-state flag to match cosmos-sdk prune cmd * give -1 magic number a name & reuse home from ctx * refactor to only open state.db & blockstore.db once * write rollback progress to one line * prevent attempting rollback of future blocks * make shard inclusive of endblock * use tagged cosmo-sdk & cometbft versions
* stub out shard CLI command * prune blocks before and after desired range * update rollback to use patched cometbft * temp override for local patched versions * handle pruning cometbft & block store state * include docs & support -1 for "latest" * update changelog * add --only-app-state flag to match cosmos-sdk prune cmd * give -1 magic number a name & reuse home from ctx * refactor to only open state.db & blockstore.db once * write rollback progress to one line * prevent attempting rollback of future blocks * make shard inclusive of endblock * use tagged cosmo-sdk & cometbft versions
* stub out shard CLI command * prune blocks before and after desired range * update rollback to use patched cometbft * temp override for local patched versions * handle pruning cometbft & block store state * include docs & support -1 for "latest" * update changelog * add --only-app-state flag to match cosmos-sdk prune cmd * give -1 magic number a name & reuse home from ctx * refactor to only open state.db & blockstore.db once * write rollback progress to one line * prevent attempting rollback of future blocks * make shard inclusive of endblock * use tagged cosmo-sdk & cometbft versions
* stub out shard CLI command * prune blocks before and after desired range * update rollback to use patched cometbft * temp override for local patched versions * handle pruning cometbft & block store state * include docs & support -1 for "latest" * update changelog * add --only-app-state flag to match cosmos-sdk prune cmd * give -1 magic number a name & reuse home from ctx * refactor to only open state.db & blockstore.db once * write rollback progress to one line * prevent attempting rollback of future blocks * make shard inclusive of endblock * use tagged cosmo-sdk & cometbft versions
* stub out shard CLI command * prune blocks before and after desired range * update rollback to use patched cometbft * temp override for local patched versions * handle pruning cometbft & block store state * include docs & support -1 for "latest" * update changelog * add --only-app-state flag to match cosmos-sdk prune cmd * give -1 magic number a name & reuse home from ctx * refactor to only open state.db & blockstore.db once * write rollback progress to one line * prevent attempting rollback of future blocks * make shard inclusive of endblock * use tagged cosmo-sdk & cometbft versions
* stub out shard CLI command * prune blocks before and after desired range * update rollback to use patched cometbft * temp override for local patched versions * handle pruning cometbft & block store state * include docs & support -1 for "latest" * update changelog * add --only-app-state flag to match cosmos-sdk prune cmd * give -1 magic number a name & reuse home from ctx * refactor to only open state.db & blockstore.db once * write rollback progress to one line * prevent attempting rollback of future blocks * make shard inclusive of endblock * use tagged cosmo-sdk & cometbft versions
* stub out shard CLI command * prune blocks before and after desired range * update rollback to use patched cometbft * temp override for local patched versions * handle pruning cometbft & block store state * include docs & support -1 for "latest" * update changelog * add --only-app-state flag to match cosmos-sdk prune cmd * give -1 magic number a name & reuse home from ctx * refactor to only open state.db & blockstore.db once * write rollback progress to one line * prevent attempting rollback of future blocks * make shard inclusive of endblock * use tagged cosmo-sdk & cometbft versions
* stub out shard CLI command * prune blocks before and after desired range * update rollback to use patched cometbft * temp override for local patched versions * handle pruning cometbft & block store state * include docs & support -1 for "latest" * update changelog * add --only-app-state flag to match cosmos-sdk prune cmd * give -1 magic number a name & reuse home from ctx * refactor to only open state.db & blockstore.db once * write rollback progress to one line * prevent attempting rollback of future blocks * make shard inclusive of endblock * use tagged cosmo-sdk & cometbft versions
* stub out shard CLI command * prune blocks before and after desired range * update rollback to use patched cometbft * temp override for local patched versions * handle pruning cometbft & block store state * include docs & support -1 for "latest" * update changelog * add --only-app-state flag to match cosmos-sdk prune cmd * give -1 magic number a name & reuse home from ctx * refactor to only open state.db & blockstore.db once * write rollback progress to one line * prevent attempting rollback of future blocks * make shard inclusive of endblock * use tagged cosmo-sdk & cometbft versions
* stub out shard CLI command * prune blocks before and after desired range * update rollback to use patched cometbft * temp override for local patched versions * handle pruning cometbft & block store state * include docs & support -1 for "latest" * update changelog * add --only-app-state flag to match cosmos-sdk prune cmd * give -1 magic number a name & reuse home from ctx * refactor to only open state.db & blockstore.db once * write rollback progress to one line * prevent attempting rollback of future blocks * make shard inclusive of endblock * use tagged cosmo-sdk & cometbft versions
* stub out shard CLI command * prune blocks before and after desired range * update rollback to use patched cometbft * temp override for local patched versions * handle pruning cometbft & block store state * include docs & support -1 for "latest" * update changelog * add --only-app-state flag to match cosmos-sdk prune cmd * give -1 magic number a name & reuse home from ctx * refactor to only open state.db & blockstore.db once * write rollback progress to one line * prevent attempting rollback of future blocks * make shard inclusive of endblock * use tagged cosmo-sdk & cometbft versions
Description
The
shard
command will remove all blocks outside a given start-end range from the databases in--home
.This relies on a patch to cometbft (Kava-Labs/cometbft#2) and cosmos-sdk (Kava-Labs/cosmos-sdk#535).
Not included: compaction of database after it has been sharded
Checklist