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

multi: Flush block DB before UTXO DB. #2649

Merged
merged 4 commits into from May 14, 2021

Commits on May 7, 2021

  1. database: Add Flush to DB interface.

    This adds a Flush method to the DB interface so that users of the DB
    type can flush the underlying database to disk as needed.
    
    The immediate use case for this is to allow for flushing dependencies.
    For example, the block database always needs to be flushed to disk prior
    to the UTXO database being flushed to disk to ensure that the UTXO
    database remains in a recoverable state in the event of an unclean
    shutdown.
    rstaudt2 committed May 7, 2021
    Copy the full SHA
    a075906 View commit details
    Browse the repository at this point in the history

Commits on May 8, 2021

  1. multi: Flush block DB before UTXO DB.

    This adds a flushBlockDB function to the UTXO cache.  The flushBlockDB
    function is used to flush the block database to disk prior to flushing
    the UTXO cache to the UTXO database.
    
    This ensures that the block database is always at least as far along as
    the UTXO database which keeps the UTXO database in a recoverable state
    in the event of an unclean shutdown.
    rstaudt2 committed May 8, 2021
    Copy the full SHA
    e21ad93 View commit details
    Browse the repository at this point in the history
  2. blockchain: Flush UTXO DB after init utxoSetState.

    This forces the UTXO database to flush to disk after initializing the
    UTXO set state for the first time.  This is necessary so that if the
    block database is flushed, and then an unclean shutdown occurs, the UTXO
    cache will know where to start from when recovering on startup.
    rstaudt2 committed May 8, 2021
    Copy the full SHA
    e499a6b View commit details
    Browse the repository at this point in the history
  3. blockchain: Force flush in separateUtxoDatabase.

    This modifies the separateUtxoDatabase upgrade to force the UTXO
    database to flush to disk prior to removing the UTXO set and state from
    the block database.
    
    This prevents a scenario where the UTXO set is removed from the block
    database and the block database is flushed to disk, but an unclean
    shutdown occurs before the UTXO database flushes to disk, leaving the
    UTXO database in an unrecoverable state.
    rstaudt2 committed May 8, 2021
    Copy the full SHA
    f0e4ff7 View commit details
    Browse the repository at this point in the history