mirror of https://github.com/apache/kafka.git
CI / build (push) Waiting to run
Details
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. Reviewers: Justine Olshan <jolshan@confluent.io>, Artem Livshits <alivshits@confluent.io> |
||
---|---|---|
.. | ||
clients-integration-tests/src/test | ||
src | ||
.gitignore |