[ https://issues.apache.org/jira/browse/KAFKA-19128?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17944365#comment-17944365 ]
Alieh Saeedi commented on KAFKA-19128: -------------------------------------- Following [~mjsax] 's idea (PR comment: [https://github.com/apache/kafka/pull/19450#issuecomment-2798404630),] the first solution is implemented. PR: https://github.com/apache/kafka/pull/19450 > Kafka Streams should not get offsets when close dirty > ----------------------------------------------------- > > Key: KAFKA-19128 > URL: https://issues.apache.org/jira/browse/KAFKA-19128 > Project: Kafka > Issue Type: Bug > Components: streams > Reporter: Alieh Saeedi > Priority: Minor > > Kafka Streams calls `prepareCommit()` in `Taskmanager#closeTaskDirty()`. The > initial purpose of this call has only been to flush the case if necessary > before suspending and closing the topology. But, calling `prepareCommit()` > results into calling other methods as well, which compute the next offsets > for the partition. However, the dirty task must not get committed and > therefore, getting offsets should not be needed as well. > Once, we encountered the following exception with AK 3.9: > {code:java} > Streams Soak encountered IllegalStateException: You can only check the > position for partitions assigned to this consumer.{code} > However, due to changes and improvements in AK 4.0, this exception can not > happen any more with AK 4.0+. BTW, the issue must get fixed. Proposed fixes > are as follows: > 1. Introduction of a flag {{prepareCommit(boolean clean)}} to determine clean > or unclean shutdown, avoiding unnecessary offset checking during dirty > shutdowns. > 2. Separating `flush` and `prepareCommit`. When closing dirty or in other > required cases, only call `flush()`. > {{}} -- This message was sent by Atlassian Jira (v8.20.10#820010)