trezor / blockbook

:blue_book: Trezor address/account balance backend

Home Page:https://trezor.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Recover / restore database after lost power?

eblackstone opened this issue · comments

The computer syncing blockbook to the bitcoin blockchain briefly lost power. I now get the following error message when starting blockbook:

I1127 07:33:36.032267    1075 rocksdb.go:88] rocksdb: opening /opt/coins/data/bitcoin/blockbook/db, required data version 3, cache size 1073741824, max open files 16384
E1127 07:33:36.235710    1075 blockbook.go:184] internalState: database is in inconsistent state and cannot be used
I1127 07:33:36.235752    1075 rocksdb.go:118] rocksdb: close

Is there any way to recover or restore the database? What is the best way to move forward? Thanks!

This is by design, you will have to delete the database folder and start again.

By default, Blockbook performs the initial import in bulk import mode, which for performance reasons does not store all the data immediately to the database. The database is therefore in an inconsistent state and does not survive hard reset of the server.

If you are in an environment, where power outages may be frequent, you can run Blockbook with parameter -workers=1, which disables the bulk import mode. As a consequence, the initial import is about twice as slow but the DB should be consistent even in the case of hard reset and also the memory requirements are a lot lower.

Understood, thanks for your quick response

This is by design, you will have to delete the database folder and start again.

By default, Blockbook performs the initial import in bulk import mode, which for performance reasons does not store all the data immediately to the database. The database is therefore in an inconsistent state and does not survive hard reset of the server.

If you are in an environment, where power outages may be frequent, you can run Blockbook with parameter -workers=1, which disables the bulk import mode. As a consequence, the initial import is about twice as slow but the DB should be consistent even in the case of hard reset and also the memory requirements are a lot lower.

How much time does btc blockbook take to sync?