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

Reduce database blocking in light-mode #3399

Merged
merged 1 commit into from
Jul 19, 2022

Conversation

HeinrichApfelmus
Copy link
Contributor

Issue number

ADP-2012

Overview

This pull request fixes an issue in light-mode where a lock on the database was kept while fetching transactions from an external blockchain data source.

Details

  • The field atomically of the DBLayer allows us to do atomic database operations.
  • Instead of wrapping the entire body of restoreBlocks into a call to atomically, we now wrap the reading and writing separately.
    • In principle, this could lead to trouble when two calls to restoreBlocks interleave — the checkpoint which we have read need no longer agree with the one we are writing to.
    • However, the old code also assumes that the calls to restoreBlocks are not interleaved. More generally, we expect that the callbacks stored in a ChainFollower are called sequentially.

@HeinrichApfelmus HeinrichApfelmus requested a review from paolino July 19, 2022 12:21
Copy link
Collaborator

@paolino paolino left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Contributor

@piotr-iohk piotr-iohk left a comment

Choose a reason for hiding this comment

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

LGTM.

Creating a wallet does not "hold" the postWallet nor blocks the listWallets endpoints any longer.
(I have some further observations, but will share them in the Jira ticket)

@HeinrichApfelmus
Copy link
Contributor Author

bors merge

@iohk-bors
Copy link
Contributor

iohk-bors bot commented Jul 19, 2022

Build succeeded:

@iohk-bors iohk-bors bot merged commit eae2729 into master Jul 19, 2022
@iohk-bors iohk-bors bot deleted the HeinrichApfelmus/ADP-2012/fix-database-blocking branch July 19, 2022 17:03
WilliamKingNoel-Bot pushed a commit that referenced this pull request Jul 19, 2022
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.

3 participants