Shekharrajak commented on code in PR #23971:
URL: https://github.com/apache/kafka/pull/23971#discussion_r4385683165
##########
server-common/src/main/java/org/apache/kafka/server/share/persister/PersisterStateManager.java:
##########
@@ -1051,52 +1063,44 @@ protected void handleRequestResponse(ClientResponse
response) {
switch (clientResponseError) {
case NONE:
- ReadShareGroupStateResponse combinedResponse =
(ReadShareGroupStateResponse) response.responseBody();
- for (ReadShareGroupStateResponseData.ReadStateResult
readStateResult : combinedResponse.data().results()) {
- if
(readStateResult.topicId().equals(partitionKey().topicId())) {
-
Optional<ReadShareGroupStateResponseData.PartitionResult> partitionStateData =
-
readStateResult.partitions().stream().filter(partitionResult ->
partitionResult.partition() == partitionKey().partition())
- .findFirst();
-
- if (partitionStateData.isPresent()) {
- Errors error =
Errors.forCode(partitionStateData.get().errorCode());
- String errorMessage =
partitionStateData.get().errorMessage();
- if (errorMessage == null ||
errorMessage.isEmpty()) {
- errorMessage = error.message();
- }
-
- switch (error) {
- case NONE:
- readStateBackoff.resetAttempts();
-
ReadShareGroupStateResponseData.ReadStateResult result =
ReadShareGroupStateResponse.toResponseReadStateResult(
- partitionKey().topicId(),
- List.of(partitionStateData.get())
- );
- this.result.complete(new
ReadShareGroupStateResponse(new ReadShareGroupStateResponseData()
- .setResults(List.of(result))));
- return;
+ ReadShareGroupStateResponseData.PartitionResult
partitionResult = lookupPartitionResult(response);
Review Comment:
lookup using map
--
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]