Skip to content
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

Pruning strategy keep_n fails to reduce database size during client genesis sync #5837

Open
peternose opened this issue Aug 28, 2024 · 0 comments
Labels
c:consensus/cometbft Category: CometBFT

Comments

@peternose
Copy link
Contributor

The pruning strategy keep_n doesn't work when syncing a client from genesis. The consensus block store located in data/consensus/data/blockstore.badger.db is never pruned, resulting in the database occupying more than 100GB of space during a mainnet sync.

One would expect this code to prune blocks, but this only occurs when a commit is finalized, not when a client processes older blocks. Restarting the client does not prune either.

Configuration:

consensus:
  prune:
    strategy: keep_n
    num_kept: 10
  checkpointer:
    disabled: true

How to prune blocks manually:

import (
	cmtstore "github.com/cometbft/cometbft/store"
	tmBadger "github.com/oasisprotocol/oasis-core/go/consensus/cometbft/db/badger"
)

func main() {
    n := 10
    tmDb, _ := tmBadger.New("data/consensus/data/blockstore.badger.db", true)
    tmBlkStore := cmtstore.NewBlockStore(tmDb)
    tmBlkStore.PruneBlocks(tmBlkStore.Height() - n)
}
@peternose peternose added the c:consensus/cometbft Category: CometBFT label Aug 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
c:consensus/cometbft Category: CometBFT
Projects
None yet
Development

No branches or pull requests

1 participant