mjsax commented on PR #19450:
URL: https://github.com/apache/kafka/pull/19450#issuecomment-2798404630

   Thanks for the PR -- I am wondering if it would be better to actually change 
`prepareCommit()` to `prepare(final boolean clean)` (instead of making 
`flush()` part of the task interface), and skip the call to 
`committableOffsetsAndMetadata()` if `clean == false` and `return null;`?
   
   As we don't want to commit, we should not even return an empty `Map` as 
guard rail, and the calling code as a matter of fact ignored the return value 
anyway (as it should).
   
   Btw: there is multiple places in with we "close dirty", to  changing from 
`prepareCommit()` to `flush()` at this place won't be sufficient. -- Adding a 
boolean flag, also has the advantage that we won't miss any caller, as we need 
to update all callers.
   
   We also don't want to lose the guard to check the task state, which we do 
inside `prepareCommit()` but not inside `flush()`.


-- 
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