-
Notifications
You must be signed in to change notification settings - Fork 167
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Allow client node to read
ChainStateView
outside the `ChainWorkerSt…
…ate` (#2124) * Derive `ClonableView` for `ChainStateView` Prepare to allow snapshots to be taken of the `ChainStateView` and used when there's a need to perform mutations on `ChainStateView` that won't be saved back to persistent storage. * Create a `save` helper method Prepare to only save after shared views into the chain state have been dropped. * Prepare to share read-only view of the chain state Only persist the chain state if there are no active readers on the shared chain state. * Add `ChainWorkerState::chain_state_view` Allow retrieving a read-only view of the `ChainStateView`, holding a lock on it. * Add `WorkerState::chain_state_view` Allow retrieving a read-only view of a `ChainStateView`, holding a lock on it. * Add a `LocalNodeClient::chain_state_view` method Allow retrieving a read-only view of a `ChainStateView`, holding a lock on it. * Create a `ReadOnlyChainStateView` helper type Allow resolving GraphQL queries to a `ChainStateView` that's behind an `OwnedRwLockReadGuard`. * Remove `load_chain` call from `ChainClient` Use `LocalNodeClient::chain_state_view` instead. * Add a `LocalNodeClient` to `ValidatorUpdater` Replace some fields with usage of the local node client instead. * Don't load chains directly from storage in updater Use the provided `LocalNodeClient` instance instead. * Prevent caching of `ChainStateView` resolver Ensure that the latest chain state is always accessed, and avoid any risk that the resolver is kept alive longer than expected, holding a lock and preventing the `ChainWorkerState` from progressing. * Work around stack overflow The `change_voting_rights::rocks_db` test in `linera-core` was failing because it overflowed its stack. While trying to investigate why, this refactor seemed to fix it. This should be good enough for now, and since this part of the code will be refactored so that it runs inside a separate task running a `ChainWorkerActor`, the stack pressure should be reduced then.
- Loading branch information
Showing
12 changed files
with
183 additions
and
67 deletions.
There are no files selected for viewing
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.