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

Bitcoin sync -> inconsistent db #964

Closed
RemcoMi opened this issue Aug 17, 2023 · 5 comments
Closed

Bitcoin sync -> inconsistent db #964

RemcoMi opened this issue Aug 17, 2023 · 5 comments

Comments

@RemcoMi
Copy link

RemcoMi commented Aug 17, 2023

We run the Bitcoin setup, installed with https://trezor.io/support/a/custom-backend-in-trezor-suite on Debian 11 VPS, 2TB SSD, 60GB RAM.

Service config:
ExecStart=/opt/coins/blockbook/bitcoin/bin/blockbook -blockchaincfg=/opt/coins/blockbook/bitcoin/config/blockchaincfg.json -datadir=/opt/coins/data/bitcoin/blockbook/db -sync -internal=:9030 -public=:9130 -certfile=/opt/coins/blockbook/bitcoin/cert/blockbook -explorer= -log_dir=/opt/coins/blockbook/bitcoin/logs -dbcache=1073741824 -enablesubnewtx -extendedindex (8 workers)

The blockbook worker slowed down completely twice already (to 600 blocks/hour for example around block 500.000). After a stop blockbook-bitcoin.service and start, we saw an error "bulk connect init, db set to inconsistent state". I now read that we shouldn't kill the process. But it seems that the sync was too slow compared to other issues.

What config should we change to do a proper sync? Both CPU and RAM usage wasn't optimal.

Even with a fresh start (bulk), some input tx are not found. Would that mean that transactions are missing in the database? Or are these transactions revisited after other bulk operations are done?
W0817 14:17:03.340849 204853 baseparser.go:38] tx 4a5633ba5380f01f02012ecc6b367a0bbac06ffe1bb49c3608fd8a6b85d2b688, input tx b6825d55d08b5329fb17362c3373981033c6cd545d8a383ef6042f521267b94d not found in txAddresses

@martinboehm
Copy link
Contributor

This seems to me like a corrupt DB. I would completely clean the /opt/coins/data/bitcoin/blockbook/db folder and start again. However, do expect that the sync will take some time even on a fast hardware, over 1-2 days.

@RemcoMi
Copy link
Author

RemcoMi commented Aug 17, 2023

Thanks. Would it make sense to use a higher dbcache (10GB?) and/or more workers to use the resources in a better way?

Even with a fresh start (bulk) after removing /opt/coins/data/bitcoin/blockbook/db, some input tx are not found. Would that mean that transactions are missing in the database? Or are these transactions revisited after other bulk operations are done?
W0817 14:17:03.340849 204853 baseparser.go:38] tx 4a5633ba5380f01f02012ecc6b367a0bbac06ffe1bb49c3608fd8a6b85d2b688, input tx b6825d55d08b5329fb17362c3373981033c6cd545d8a383ef6042f521267b94d not found in txAddresses

@martinboehm
Copy link
Contributor

There should be no such warnings in the log. We just reindexed our Bitcoin and did not get any warnings.
Larger cache will almost certainly improve the situation, however I do not think it will be that substantial.

@RemcoMi
Copy link
Author

RemcoMi commented Aug 19, 2023

To be sure, we restarted with 1 worker.
However, this will probably take a couple weeks as it currently (around block 350.000) processes 1.185 blocks/hour..

@martinboehm
Copy link
Contributor

OK. We have no issues running sync in bulk mode, it is able to process about 6k late blocks/hour. The blocks around 350.000 are processed almost immediately.

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

2 participants