shotover / shotover-proxy

L7 data-layer proxy
https://docs.shotover.io
Apache License 2.0
83 stars 16 forks source link

Fix determining the coordinator for OffsetFetch requests #1742

Closed rukai closed 1 week ago

rukai commented 1 week ago

As per the documentation: https://docs.rs/kafka-protocol/latest/kafka_protocol/messages/offset_fetch_request/struct.OffsetFetchRequest.html The group_id field on OffsetFetchRequest is only valid for API versions 0-7. However in the logic for determining group ids that require a metadata query (specifically FindCoordinator), we currently use this field regardless of the requests API version. As a result if a client sends a request of version 8 or 9 shotover may not have the required metadata to route this request. This is causing a particular problem in https://github.com/shotover/shotover-proxy/pull/1734 where outdated metadata is not updated, causing shotover to continue routing to the down node.

This PR fixes our handling for API version 8-9 by adding specific handling for version 8-9. The additional logic iterates over the new groups field instead of group_id.

codspeed-hq[bot] commented 1 week ago

CodSpeed Performance Report

Merging #1742 will improve performances by 13.54%

Comparing rukai:fix_coordinator_fetching_for_offset_fetch (1f1314a) with main (149dc70)

Summary

⚡ 1 improvements ✅ 38 untouched benchmarks

Benchmarks breakdown

Benchmark main rukai:fix_coordinator_fetching_for_offset_fetch Change
encode_system.local_result_v5_no_compression 105.6 µs 93 µs +13.54%