[qs] dedup requests to batch fetcher and simplify payload manager #15766
+457
−608
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.
Description
This PR aims to simplify the PayloadManager logic to retrieve batch payload from quorum store. To reduce complexity, we no longer cache transactions in PayloadManager. As long as quorum store stores the payload in memory, retrieval should be very fast and does not require caching in payload manager.
payload_manager.rs
into separate modules one each for direct mempool, consensus observer, and quorum store.QuorumStorePayloadManager
always requests QuorumStore for payload which will return a future that resolves into the payload upon completion. On prefetch, this future is ignored andBatchReaderImpl
will spawn a task to drive the future.BatchReaderImpl
implements deduplication logic to ensure there is only one inflight fetch request per batch. It returns a shared future that the caller can await on to get the payload. The future is driven by a tokio task, so the caller don't need to.await
immediately to drive the future.TODO: add counters to measure retrieval duration