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

Correctly deal with unknown blocks when initializing ledger DB in presence of EBBs #1454

Closed
edsko opened this issue Jan 13, 2020 · 2 comments
Labels
bug Something isn't working chain db consensus issues related to ouroboros-consensus
Milestone

Comments

@edsko
Copy link
Contributor

edsko commented Jan 13, 2020

When we initialize the ledger DB, it is possible that a ledger DB on-disk snapshot refers to a block that is expected to be present in the immutable DB, but isn't. When this happens, we should discard the snapshot and try to use an older snapshot instead.

This was already implemented, but the way we checked whether the block was present was by comparing slot numbers. If the slot number of the Point required by the ledger DB was present in the immutable DB, we assumed that the block must be present. This isn't correct, however. It is possible that the immutable DB contains an EBB of that slot, by the ledger DB snapshot refers to the regular block in the same slot. In this scenario, initialization of the ledger DB failed with an internal error, and we would not attempt to try an earlier version.

@edsko edsko added bug Something isn't working consensus issues related to ouroboros-consensus chain db labels Jan 13, 2020
@edsko
Copy link
Contributor Author

edsko commented Jan 13, 2020

Note that there are two ways for the on-disk ledger DB snapshot to refer to a block that is intended to be in the immutable DB, but isn't:

  1. Data loss in the imm DB
  2. We take a snapshot of the ledger DB, but haven't yet copied all now-immutable blocks from the volatile DB to the immutable DB.

Note that (2) is not actually all that unlikely now that we take a ledger DB snapshot when we shut down the node. We should think about this.

@edsko
Copy link
Contributor Author

edsko commented Jan 14, 2020

Closed in #1451.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working chain db consensus issues related to ouroboros-consensus
Projects
None yet
Development

No branches or pull requests

2 participants