ryerraguntla commented on code in PR #4258:
URL: https://github.com/apache/iggy/pull/4258#discussion_r4093482057


##########
gateways/kafka/src/protocol/handlers/metadata.rs:
##########
@@ -111,6 +379,51 @@ pub fn encode_response(
     encode_message(&resp, response_version, 256)
 }
 
+/// Real (bridge-backed) response: unlike [`encode_response`], each topic 
carries its own
+/// resolved error code and, on success, one [`MetadataResponsePartition`] per 
partition with
+/// this gateway's single broker (node id 1) as leader/replica/ISR - there is 
only ever one
+/// broker behind this gateway, so that triple is never actually in question.
+fn encode_real_response(
+    response_version: i16,
+    results: &[TopicResult],
+    broker: &BrokerAdvertise,
+) -> Result<Bytes> {
+    let response_topics = results
+        .iter()
+        .map(|result| {
+            let partitions = if result.error_code == ERROR_NONE {

Review Comment:
     Fixed . above BLOCKING_ENCODE_PARTITION_THRESHOLD (20,000 partitions total 
across the response — picked conservatively off one measured data point, not 
profiled, flagged for a
     real benchmark), encode_real_response runs via tokio::task::spawn_blocking 
instead of inline. Below the threshold, unchanged (no thread-hop cost added to 
the common case). 



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to