showuon opened a new pull request #11019:
URL: https://github.com/apache/kafka/pull/11019


   Some issues found in the `DeleteConsumerGroupOffsetsHandler`:
   1. if `coordinator errors` is put in the topic partition, plus a 
Errors.NONE, we'll failed with `IllegalArgumentException: Partition foo was not 
included in the original request`. This is the new added test case scenario: 
`testDeleteConsumerGroupOffsetsResponseIncludeCoordinatorErrorAndNoneError`
   2. Didn't handle all possible exceptions, so there will be "expected" 
exception, but be logged as "unexpected exception"
   3. Mix the group error handler with partition error handler
   4. In `DeleteConsumerGroupOffsetsHandlerTest`, we build all errors in 
partition result, including group error. Split group error tests and partition 
error tests.
   
   This is the old handle response logic. FYI:
   ```java
   void handleResponse(AbstractResponse abstractResponse) {
       final OffsetDeleteResponse response = (OffsetDeleteResponse) 
abstractResponse;
   
       // If coordinator changed since we fetched it, retry
       if (ConsumerGroupOperationContext.hasCoordinatorMoved(response)) {
           Call call = getDeleteConsumerGroupOffsetsCall(context, partitions);
           rescheduleFindCoordinatorTask(context, () -> call, this);
           return;
       }
   
       // If the error is an error at the group level, the future is failed 
with it
       final Errors groupError = Errors.forCode(response.data().errorCode());
       if (handleGroupRequestError(groupError, context.future()))
           return;
   
       final Map<TopicPartition, Errors> partitions = new HashMap<>();
       response.data().topics().forEach(topic -> 
topic.partitions().forEach(partition -> partitions.put(
           new TopicPartition(topic.name(), partition.partitionIndex()),
           Errors.forCode(partition.errorCode())))
       );
   
       context.future().complete(partitions);
   }
   ```
   
   ### Committer Checklist (excluded from commit message)
   - [ ] Verify design and implementation 
   - [ ] Verify test coverage and CI build status
   - [ ] Verify documentation (including upgrade notes)
   


-- 
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-unsubscr...@kafka.apache.org

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


Reply via email to