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

Migrating from leveldb to pebbledb. How to enable pebble db backend? #2647

Closed
qezz opened this issue Aug 14, 2024 · 14 comments
Closed

Migrating from leveldb to pebbledb. How to enable pebble db backend? #2647

qezz opened this issue Aug 14, 2024 · 14 comments
Assignees

Comments

@qezz
Copy link

qezz commented Aug 14, 2024

We were running v1.4.10 on hash+leveldb.

Following the https://forum.bnbchain.org/t/faq-pbss-pebbledb/2260

As it is already the default mode, you don’t need extra configuration to use PBSS + PebbleDB.

I fetched the snapshot from https://github.com/48Club/bsc-snapshots?tab=readme-ov-file#geth-full-node-with-pbss, replaced the previous data dir with this one.

I didnt change any args, as it says in the https://forum.bnbchain.org/t/faq-pbss-pebbledb/2260

After I started the node, I see

Aug 14 09:47:52 geth[88073]: INFO [08-14|09:47:52.454] Using leveldb as the backing database
Aug 14 09:47:52 geth[88117]: INFO [08-14|09:47:52.918] Using leveldb as the backing database
Aug 14 09:47:57 geth[88117]: INFO [08-14|09:47:57.314] Using LevelDB as the backing database
Aug 14 09:47:57 geth[88117]: INFO [08-14|09:47:57.360] State scheme set to default              scheme=path
Aug 14 09:47:57 geth[88117]: INFO [08-14|09:47:57.360] Allocated memory caches                  state_scheme=path trie_clean_cache=33.32GiB trie_dirty_cache=256.00MiB snapshot_cache=16.78GiB

Moreover the database dir (chaindata) was automatically wiped by the process, and it's now trying to fetch data from 4y ago.

What am I doing wrong?

@zzzckck
Copy link
Collaborator

zzzckck commented Aug 14, 2024

@qezz could you provide the arguments of how to run your node?
And I will double check with 48Club, seems like they provide the snapshot with Path & LevelDB mode.

@qezz
Copy link
Author

qezz commented Aug 14, 2024

@zzzckck here are the args we use

ExecStart=/opt/validators/bsc/bin/1.4.10/geth \
         --datadir /opt/validators/bsc/data \
         --config /opt/validators/bsc/config/config.toml \
         --monitor.doublesign \
         --history.transactions=0 \
         --syncmode=full --tries-verify-mode=none --pruneancient=true --diffblock=5000 \
         --cache 98304 --metrics --metrics.addr="0.0.0.0"

@buddh0 buddh0 self-assigned this Aug 15, 2024
@qezz
Copy link
Author

qezz commented Aug 15, 2024

To clarify, before restart with the new datadir I switched the binary to the "latest stable release", which is 1.4.13

@buddh0
Copy link
Collaborator

buddh0 commented Aug 19, 2024

@qezz

  1. how does your datadir looks like?
    /opt/validators/bsc/data/chaindata or /opt/validators/bsc/data/geth/chaindata? the later is right.
  2. maybe you configured DBEngine = leveldb in config.toml, if so please remove it

@qezz
Copy link
Author

qezz commented Aug 19, 2024

@buddh0

1

root@rpc05:/opt/validators/bsc# realpath data/geth/chaindata/
/opt/validators/bsc/data/geth/chaindata

root@rpc05:/opt/validators/bsc# ls -lah data/geth/chaindata/LOG
-rw-r--r-- 1 bsc bsc 533K Aug 19 19:37 data/geth/chaindata/LOG

2

root@rpc05:/opt/validators/bsc# cat config/config.toml | grep -Ei DBEngine | wc -l
0

@buddh0
Copy link
Collaborator

buddh0 commented Aug 20, 2024

I tried many times locally, not find the same issue
I think your action replaced the previous data dir with this one maybe not execute correctly
may you do more check?

  1. before restart with new data,
    are there. any '.ldb' files in data/geth/chaindata/? or '.sst' exist?
    '.ldb' indacate the leveldb, and '.sst' files indacate the pebble db.
  2. check the size before restart
    du -sh /opt/validators/bsc/data/geth

@NathanBSC
Copy link
Contributor

if no other people report the same issue, this issue will be closed 3 days later (08/23)

@qezz
Copy link
Author

qezz commented Aug 21, 2024

I'm OOO for 2 days, will check back a bit later.

@qezz
Copy link
Author

qezz commented Aug 21, 2024

By any chance, is there a flag to force the db backend to be the pebbledb? So we don't need to guess if it's applied properly or not

@zzzckck
Copy link
Collaborator

zzzckck commented Aug 22, 2024

By any chance, is there a flag to force the db backend to be the pebbledb? So we don't need to guess if it's applied properly or not

I am afraid there is no such flag, the database will be determined since genesis block and can not be changed after that.

@qezz
Copy link
Author

qezz commented Aug 22, 2024

@zzzckck just to clarify then, what is this option?
image

@zzzckck
Copy link
Collaborator

zzzckck commented Aug 23, 2024

@zzzckck just to clarify then, what is this option? image

this option try to use PebbleDB, and it will report error if the underlying database format is LevelDB. It can not covert the database, but indicate user wanna use PebbleDB, but it is not the case, it will fail.

@qezz
Copy link
Author

qezz commented Aug 23, 2024

this option try to use PebbleDB, and it will report error if the underlying database format is LevelDB.

That's exactly what I need, thanks.

@qezz
Copy link
Author

qezz commented Aug 27, 2024

It seems to help or whatever.
Differences are:

  • fetched a fresh snapshot
  • provided the --db.engine=pebble flag

UPD:

root@rpc05:~# journalctl -alxfu bsc -n 100000 --no-host | grep -iE "scheme|backing database"
Aug 28 11:22:35 geth[2045963]: INFO [08-28|11:22:35.088] Using pebble as the backing database
Aug 28 11:22:54 geth[2045963]: INFO [08-28|11:22:54.651] State scheme set to already existing disk db scheme=path
Aug 28 11:22:54 geth[2045963]: INFO [08-28|11:22:54.651] Allocated memory caches                  state_scheme=path trie_clean_cache=33.32GiB trie_dirty_cache=256.00MiB snapshot_cache=16.78GiB

@qezz qezz closed this as completed Aug 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants