From 9eedf0970a9ede79971f42587c5e2bc38d211896 Mon Sep 17 00:00:00 2001 From: Michael Boquard Date: Thu, 21 Dec 2023 13:05:51 -0500 Subject: [PATCH] kafka: Don't set rack ID if empty Take into consideration that if the fetch request's rack ID is an empty string, act as if no rack ID was provided. Signed-off-by: Michael Boquard (cherry picked from commit ec6838a7aa55602759f471e3959b0041937d0116) --- src/v/kafka/server/handlers/fetch.cc | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/v/kafka/server/handlers/fetch.cc b/src/v/kafka/server/handlers/fetch.cc index b0c619fa356f..429f115befe3 100644 --- a/src/v/kafka/server/handlers/fetch.cc +++ b/src/v/kafka/server/handlers/fetch.cc @@ -797,7 +797,10 @@ class simple_fetch_planner final : public fetch_planner::impl { .strict_max_bytes = octx.response_size > 0, .skip_read = bytes_left_in_plan == 0 && max_bytes == 0, .read_from_follower = octx.request.has_rack_id(), - .consumer_rack_id = octx.request.data.rack_id, + .consumer_rack_id = octx.request.has_rack_id() + ? std::make_optional( + octx.request.data.rack_id) + : std::nullopt, .abort_source = octx.rctx.abort_source(), .client_address = model::client_address_t{client_address}, };