With a private network running for several months, I accidentally called the command horizon db clear, and then Horizon now shows:

"history_latest_ledger": 2576535,
"history_elder_ledger": 1830026,

i.e. the Horizon DB now holds only transactions between ledger #1830026 ~ #2576535, in the table <history_transactions>.


At stellar-core.cfg, I have CATCHUP_COMPLETE=true since the beginning.


Is there any way to get back the transaction prior to #1830026 to <history_transactions>? (other than re-building Stellar-Core from new DB)

up vote 1 down vote accepted

In the most recent release of horizon; v0.15.* you can do: horizon db backfill N

where N is the number of missing ledgers you want added to your horizon history.

So in your case it will be horizon db backfill 1830025

Note that even if you have CATCHUP_COMPLETE=true, you might not have all the ledgers in the core database unless you have disabled maintenance mode in stellar core; which I believe is enabled by default.

You can check the oldest ledger you have in stellar core by querying the database.

SELECT MIN(ledgerseq) FROM ledgerheaders; The value will be 1 if you have the complete history

If stellar core does not have the history any longer, then you might have to run catchup again to get the data from the history archives(assuming you configured these).

In the future, you might want to have a backup of your horizon DB.

  • Didn't notice the release of v0.15, will update now. Thanks! – cesarm 2 days ago

Your Answer

 

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.