You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
After looking at the Go source code, I found this under services/horizon/cmd/db.go:
vardbReapCmd=&cobra.Command{
Use: "reap",
Short: "reaps (i.e. removes) any reapable history data",
Long: "reap removes any historical data that is earlier than the configured retention cutoff",
Run: func(cmd*cobra.Command, args []string) {
err:=initApp().DeleteUnretainedHistory()
iferr!=nil {
log.Fatal(err)
}
},
}
I believe the issue arises because the db reap command is calling initApp().DeleteUnretainedHistory() without an updated view of the current state of the ledger. Without an updated view of the current state of the ledger, the DeleteUnretainedHistory will fail because the latest ledger number will be Zero, making the target ledger number to have an invalid negative value.
Indeed, adding the following line of code completely solves the issue on my end: initApp().UpdateLedgerState()
vardbReapCmd=&cobra.Command{
Use: "reap",
Short: "reaps (i.e. removes) any reapable history data",
Long: "reap removes any historical data that is earlier than the configured retention cutoff",
Run: func(cmd*cobra.Command, args []string) {
//Adding the following line prior to calling DeleteUnretainedHistory fixed the issue on my end.initApp().UpdateLedgerState()
err:=initApp().DeleteUnretainedHistory()
iferr!=nil {
log.Fatal(err)
}
},
}
What version are you using?
horizon v0.24.1
What did you do?
I ran:
horizon --history-retention-count 10000 db reap
including all other necessary command line arguments.
What did you expect to see?
I expected to see feedback that the reaper actually reaped older unnecessary ledger entries in the horizon database.
What did you see instead?
Nothing. The command line returned with no error messages.
The text was updated successfully, but these errors were encountered: