You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jira@kafka.apache.org by "dajac (via GitHub)" <gi...@apache.org> on 2023/06/12 12:41:35 UTC

[GitHub] [kafka] dajac commented on a diff in pull request #13240: KAFKA-14690: Add topic IDs to the OffsetCommit API version 9

dajac commented on code in PR #13240:
URL: https://github.com/apache/kafka/pull/13240#discussion_r1226607855


##########
clients/src/main/java/org/apache/kafka/clients/consumer/internals/ConsumerCoordinator.java:
##########
@@ -1354,8 +1373,21 @@ public void handle(OffsetCommitResponse commitResponse, RequestFuture<Void> futu
             Set<String> unauthorizedTopics = new HashSet<>();
 
             for (OffsetCommitResponseData.OffsetCommitResponseTopic topic : commitResponse.data().topics()) {
+                String topicName = topic.name();
+
+                if (this.response.requestHeader().apiVersion() >= 9) {
+                    topicName = topicIdAndNames.topicNameOrNull(topic.topicId());
+
+                    if (topicName == null) {
+                        // Could only happen if the broker replied with an ID which was not in the request and
+                        // unknown by this client. This would be a bug.
+                        log.warn("Ignoring invalid topic ID found in OffsetCommit response: " + topic.topicId());
+                        continue;
+                    }

Review Comment:
   As a second thought, I wonder if we should complete the future with an exception here. Being defensive would help us to catch bugs early one. What do you think?



-- 
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: jira-unsubscribe@kafka.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org