flow-go
flow-go copied to clipboard
[Storage] Use lockctx to store approvals
Working towards https://github.com/onflow/flow-go/issues/7355. This PR addresses part of the second category:
- Existing usage of a lock within the storage layer (currently marked with TODO(7355) in https://github.com/onflow/flow-go/issues/7138)
This PR introduces the lockctx manager and uses it in storing the approvals. The lockctx manager helps to ensure we don't overwrite conflicting approvals for the same block.
This PR also removes the deprecated badger transaction models that stores approvals.
Codecov Report
Attention: Patch coverage is 34.86842% with 99 lines in your changes missing coverage. Please review.
:loudspeaker: Thoughts on this report? Let us know!
Hey @zhangchiqing, it looks like this PR is replicating many of the changes added in https://github.com/onflow/flow-go/pull/7364, but in different commits without sharing Git history. Can you explain which set of changes you're planning to eventually include in master? From my perspective, it would make the most sense for this PR adding the Approvals storage module changes to extend https://github.com/onflow/flow-go/pull/7364, where lockctx is added.
If possible, I want to avoid a situation where we are simultaneously reviewing and modifying the same set of changes in two different PRs (this one and https://github.com/onflow/flow-go/pull/7364), because it's difficult to keep them consistent.
@jordanschalm yeah, https://github.com/onflow/flow-go/pull/7364 is gonna be merged to feature branch, and stay there for a while. But I think the lock manager could be merged to master earlier, before the feature branch gets merged.
It's hard to cherry-pick your changes from 7364 into this PR, I tried but doesn't work, only managed to cherry-pick one commit. For the rest, I had to copy over the changes into this PR.