-
Notifications
You must be signed in to change notification settings - Fork 11.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[gql][1/n] cross-query consistency (#16635)
## Description Today, every query in a graphql request separately makes a query for the available range. This means that every query is self-consistent (so if it is paginated, you will continue paginating the state at the same checkpoint as you started), but if you issue multiple queries at the same time, each query in the graphql request may see different available range values. This can result in inconsistencies in the results of disjoint queries in the same request: ``` query { alice: address(address: 0xA11CE) { objects { nodes { digest } } } bob: address(address: 0xB0B) { objects { nodes { digest } } } } ``` The above query might witness the same object twice, or no times, based on timing, if issued around the time that Alice transfers that object to Bob. This PR adds cross-query consistency by launching a background task that periodically updates the available range, which gets passed to the graphql service. Every top-level query in the request will inherit this available range. Additionally, instead of making a separate fetch when `Query.availableRange` is selected for, the resolver will simply return the available range from the background task. Subsequent PRs will change `checkpoint_viewed_at` from `Option<u64>` to `u64` and simplify the logic around handling consistency for nested fields. ## Test Plan Existing tests should pass. Because of the background task, we also need to wait for the graphql service to "catch up" to the latest checkpoint --- If your changes are not user-facing and do not break anything, you can skip the following section. Otherwise, please briefly describe what has changed under the Release Notes section. ### Type of Change (Check all that apply) - [ ] protocol change - [ ] user-visible impact - [ ] breaking change for a client SDKs - [ ] breaking change for FNs (FN binary must upgrade) - [ ] breaking change for validators or node operators (must upgrade binaries) - [ ] breaking change for on-chain data layout - [ ] necessitate either a data wipe or data migration ### Release notes
- Loading branch information
Showing
14 changed files
with
472 additions
and
257 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Oops, something went wrong.