bsc icon indicating copy to clipboard operation
bsc copied to clipboard

How can I perform pruning in a PBSS+PebbleDB Blockdata environment?

Open marblex-sjyu opened this issue 1 year ago • 5 comments

hello. When using BNB Chain PBSS+PebbleDB Blockdata, is there a way to prune only a certain number of blocks?

I have checked and tested the following two situations.

Case.1 : Prune Ancient Data in Real Time

I looked at the "--pruneancient" option. According to the description of this option, it only leaves 90,000 blocks, I decided that this was not the option I wanted.

I would like to leave 1,000,000 blocks, is there a way to do that?

cc link : https://docs.bnbchain.org/docs/validator/node-maintenance/#prune-ancient-data-in-real-time https://github.com/bnb-chain/bsc/issues/1142

Case.2 : Prune Block Tools I tried the geth snapshot prune-block command with the "-block-amount-reserved" option, which allows you to specify the number of blocks to keep. However, I got an error message "Fatal: incompatible state scheme, stored: path, config: hash"

Based on the message, it looks like you don't support PBSS, are there any additional options?

cc link : https://docs.bnbchain.org/docs/validator/node-maintenance/#prune-block-tools

marblex-sjyu avatar Mar 14 '24 07:03 marblex-sjyu

I would like to leave 1,000,000 blocks, is there a way to do that?

Not possible. Maybe we can look into it.

Based on the message, it looks like you don't support PBSS, are there any additional options?

We do support PBSS, by using the flag state.scheme path. Can you share the command that you used to do block pruning?

weiihann avatar Mar 14 '24 09:03 weiihann

I would like to leave 1,000,000 blocks, is there a way to do that?

Not possible. Maybe we can look into it.

Based on the message, it looks like you don't support PBSS, are there any additional options?

We do support PBSS, by using the flag state.scheme path. Can you share the command that you used to do block pruning?

We used the command below When I check with the "--help" option, it says that the "state.scheme path" is missing, and I need to know exactly how to apply the option. ./geth snapshot prune-block --datadir /data01/bnb_mainnet/data --datadir.ancient ./chaindata/ancient --block-amount-reserved 100000

ghost avatar Mar 14 '24 09:03 ghost

What's your BSC version? Anyways, you can apply the option by adding --state.scheme path.

weiihann avatar Mar 14 '24 09:03 weiihann

What's your BSC version? Anyways, you can apply the option by adding --state.scheme path.

I did this on two versions: v1.3.7, v1.3.10. However, the result was the same error. [error msg] "Incorrect Usage: flag provided but not defined: --state.scheme"

We've looked at code that has prune-block functionality, but "--state.scheme" option doesn't seem to be specifiable.

https://github.com/bnb-chain/bsc/blob/c8cc91963f6c643f6db87378450d94c114229f24/cmd/geth/snapshot.go#L79

ghost avatar Mar 14 '24 09:03 ghost

Try this fix and see if it works for you: https://github.com/weiihann/bsc/tree/v1.3.10/prune-block

weiihann avatar Mar 15 '24 02:03 weiihann