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

   Jira: [KAFKA-14010](https://issues.apache.org/jira/browse/KAFKA-14010)
   
   When `Partition#submitAlterPartition` submits ISR update and send out the 
Alter_Isr request, we'll register a callback with `Future.whenComplete` 
[here](https://github.com/apache/kafka/blob/trunk/core/src/main/scala/kafka/cluster/Partition.scala#L1585).
 Later, when the Alter_Isr response received, we use `try/finally` to first 
trigger the callback, and remove the `unsentIsrUpdates` later 
[here](https://github.com/apache/kafka/blob/trunk/core/src/main/scala/kafka/server/AlterPartitionManager.scala#L362-L369).
 Because of this, inside the callback, when we found there is retriable error, 
we'll retry, but then, we found there's an "in-flight" reqeust because 
`unsentIsrUpdates` is not removed, which causes the retry didn't actually send 
out successfully.
   
   In this PR, I did:
   1. fix the above described bug by removing the `unsentIsrUpdates` before 
calling callback. I've confirmed in the callback, we never care about the 
status of `unsentIsrUpdates`.
   2. Currently, when we tried to enqueue an ISR update failed due to there's 
`unsentIsrUpdates`, we throw out `OperationNotAttemptedException`, and later, 
we'll treat it as no-op from controller, and no retry + change the state to 
"committed" 
[here](https://github.com/apache/kafka/blob/trunk/core/src/main/scala/kafka/cluster/Partition.scala#L1631).
 So, it won't retry the ISR update, which is unexpected. Change it to 
`IllegalStateException`, so that we'll treat it as "other exception", and will 
retry this ISR update.
   
   ### 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: [email protected]

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

Reply via email to