JimmyWang6 commented on code in PR #19820:
URL: https://github.com/apache/kafka/pull/19820#discussion_r2164757904
##########
group-coordinator/src/main/java/org/apache/kafka/coordinator/group/GroupCoordinatorService.java:
##########
@@ -682,15 +682,43 @@ CompletableFuture<AlterShareGroupOffsetsResponseData>
persisterInitialize(
handlePersisterInitializeResponse(request.groupTopicPartitionData().groupId(),
result, new ShareGroupHeartbeatResponseData());
return response;
} else {
- //TODO build new AlterShareGroupOffsetsResponseData
for error response
- return response;
+ return buildErrorResponse(response, result);
}
} else {
return buildErrorResponse(request, response, exp);
}
});
}
+
+ private AlterShareGroupOffsetsResponseData
buildErrorResponse(AlterShareGroupOffsetsResponseData response,
InitializeShareGroupStateResult result) {
+ AlterShareGroupOffsetsResponseData data = new
AlterShareGroupOffsetsResponseData();
+ data.setResponses(
+ new
AlterShareGroupOffsetsResponseData.AlterShareGroupOffsetsResponseTopicCollection(response.responses().stream()
+ .map(topic -> {
+
AlterShareGroupOffsetsResponseData.AlterShareGroupOffsetsResponseTopic
topicData = new
AlterShareGroupOffsetsResponseData.AlterShareGroupOffsetsResponseTopic()
+ .setTopicName(topic.topicName());
+ topic.partitions().forEach(partition -> {
+
AlterShareGroupOffsetsResponseData.AlterShareGroupOffsetsResponsePartition
partitionData;
+ PartitionErrorData error =
result.getErrors().get(topic.topicId()).get(partition.partitionIndex());
Review Comment:
Good catch! My idea is if users want to alter one nonexistent partition, the
error code and message will be added to `AlterShareGroupOffsetsResponseData`
when executing `groupMetadataManager.completeAlterShareGroupOffsets`. So I plan
to skip the processed topicPartition which already had an error code, for which
the rest of the partitions should exist in InitializeShareGroupStateResult.
--
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]