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

db-sync: Log an error if excessive rollback is required on startup #401

Merged
merged 1 commit into from
Nov 11, 2020

Conversation

erikd
Copy link
Contributor

@erikd erikd commented Nov 11, 2020

No description provided.

when (count > 50000) .
liftIO . logError trce $
mconcat
[ "Rollback block count is high and therefore rollback is likley to be incredibly slow. "

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

typo "likely"

liftIO . logError trce $
mconcat
[ "Rollback block count is high and therefore rollback is likley to be incredibly slow. "
, "Dropping the database and resyncing from scratch will be faster."

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would also add a line saying 'Make sure you have correctly set the state directory/volume.'

Copy link
Contributor Author

@erikd erikd Nov 11, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That is superfluous. The --state-dir parameter must be set on the command line, and the directory is created it if does not exist.

Since version 6.0.0, db-sync has two data stores; PostgreSQL and a
snapshot of ledger state stored on disk. There are a couple of
potential problems with this:
* If the 'db-sync' software version changes, the ledger state written by
  the old version may not be readable by the new version.
* If the ledger state is missing (eg accidentally deleted).

In both of these cases 'db-sync' will try to rollback the database to
block zero. Unfortunately, the current version of the Haskell/Persistent
library is unable to do fast efficient rollbacks, and rolling back from
mainnet tip to block zero is likely to take several days.

This commit logs an error message when the rollback is likely to be
slow. It does not halt the rollback, just logs the following error:

   Rollback block count is high and therefore rollback is likley to be incredibly
   slow. Dropping the database and resyncing from scratch will be faster.

It is up to the operator to drop the database and restart.
@erikd erikd merged commit d909e02 into master Nov 11, 2020
@iohk-bors iohk-bors bot deleted the erikd/rollback branch November 11, 2020 20:53
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

Successfully merging this pull request may close these issues.

None yet

2 participants