Defer store read/write from iterator loop#571
Merged
Conversation
yzang2019
approved these changes
Feb 17, 2023
|
philipsu522
approved these changes
Feb 17, 2023
Contributor
philipsu522
left a comment
There was a problem hiding this comment.
I wonder if it's possible to add some sort of unit test that ensures that panics to ensure that there is no store read/write within iterator loop? We can also have a whitelist of "stores" that are allowed to do this (i.e. oracle). Wdyt?
This can be a separate PR though
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Describe your changes and provide context
Performing store access before an iterator is closed may cause deadlocks (see #567 for context).
This PR refactors existing logic to move store access that were previously within iterator's scope to be after iterator closure.
Note that there are still cases for this in oracle keeper, but all the methods there are only called in oracle's Mid/EndBlock, which are not parallelized in any way and thus not subject to the deadlock issue
Testing performed to validate your change
unit tests + existing tests