subql
subql copied to clipboard
Lock queried rows for each block transaction
Description
Puts a lock on each query made by handlers in each block.
⚠️ This is untested ⚠️ Things to test:
- It adds the concurrency guarantee we want
- Because we have a transaction for each block, if there are multiple handlers run for the same block that accesses the same value can they still update a single entity multiple times
Motivation
With multichain indexing we need some more concurrency guarantees. We want to prevent the following example from happening.
Chain A reads entity X and then updates it to a new value. Between reading X and updating it chain B updates X.
Type of change
- [x] New feature (non-breaking change which adds functionality)
Checklist
- [ ] I have tested locally
- [ ] I have performed a self review of my changes
- [ ] Updated any relevant documentation
- [ ] Linked to any relevant issues
- [ ] I have added tests relevant to my changes
- [ ] Any dependent changes have been merged and published in downstream modules
- [ ] My code is up to date with the base branch