KafkaSinkCluster: rack aware routing for fetch requests #1637
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.
Progress towards: #1526
With this PR shotover should now route all requests to their correct rack.
In order to catch misconfigurations, or even shotover bugs, a
shotover_out_of_rack_requests_count
metric is introduced to count out of rack requests.This matches the
shotover_out_of_rack_requests_count
metric used in CassandraSinkCluster.Fetch requests can be routed to any replica, some of which are in shotover's rack and some are outside of shotover's rack.
Previously we were just sending fetch requests to a random replica.
But with this PR we now always send to a replica within shotover's rack, unless such a replica does not exist in which case we fall back to any replica at all.
To make this routing cheap to perform at runtime, shotover's stored partition replica nodes list is split into
shotover_rack_replica_nodes
andexternal_rack_replica_nodes
fields.For all other request types, there is only one possible destination.
For these request types shotover modifies the metadata response such that the client will send requests to the shotover in the same rack as the destination, ensuring that no cross-rack routing occurs.
e.g.
MetadataResponse::controller_id
is set to the shotover in the rack of the controller broker.shotover-proxy/shotover/src/transforms/kafka/sink_cluster/mod.rs
Lines 1515 to 1525 in 6fb74a2
TODO in follow up PR:
out_of_rack_requests.increment(1)