Avoid using errors to communicate the state of other shards to the leader during query-status API. #1520
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.
Before this change, when the leader shard received a query-status API, it would call a match-status API on its shards, which would return an error if the state was different. The error contained the status of each shard, that the leader would use to compute the overall helper state. This wasn't the intended behavior, and was only done as a stop-gap solution, because the
Transport::send
(and consequentlyTransport::broadcast
) returned unit "()", prohibiting from receiving the state from other shards. This PR changes this:Transport::send
now returns a configurable associated type for all requests (Transport::SendReponse
)BodyStream
.I also tried a bunch of things so that
Transport::send
would return a specific type, bound to the route, but it all seemed very complex. The goal was that QueryStatus route would return a QueryStatusResponse, the rest could just return unit. That task can be tackled separately in the future.