rreddy-22 opened a new pull request, #20039: URL: https://github.com/apache/kafka/pull/20039
When initPid(keepPrepared = true) is called after a client crashes, several situations should be considered. When there's an ongoing transaction, we can transition it to the newly added PREPARED_TRANSACTION state. However, what if there's no ongoing transaction? Another scenario could be: - Issued a commit, to commit prepared - The commit succeeded on the TC, but the client crashed - Client restarted with keepPreparedTxn=true (because it doesn't know if the commit succeeded or not and needs to keep retrying the commit until it's successful) - Issued a commit, but the transaction is not ongoing, because it's committed **Solution:** This is a perfectly valid scenario as the external transaction coordinator for the 2PC transaction will keep committing participants, and the participants need to eventually return success (that's a guarantee for a prepared transaction). _Rejected Alt 1_ -> Return an InvalidTxnStateException : Returning an error would break the above scenario. _Rejected Alt 2_ -> Then the next thought is that we should somehow validate if the state is expected, but we don't have data to validate the result against. **Final Solution:** Just returning the success and transitioning to READY is the proper handling of this condition. -- 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