GitHub user guozhangwang opened a pull request: https://github.com/apache/kafka/pull/3287
KAFKA-5416: Re-prepare transition to CompleteCommit/Abort upon retrying append to log In `TransationStateManager`, we reset the pending state if an error occurred while appending to log; this is correct except that for the `TransactionMarkerChannelManager`, as it will retry appending to log and if eventually it succeeded, the transaction metadata's completing transition will throw an IllegalStateException since pending state is None, this will be thrown all the way to the `KafkaApis` and be swallowed. 1. When re-enqueueing to the retry append queue, re-prepare transition to set its pending state. 2. A bunch of log4j improvements based the debugging experience. The main principle is to make sure all error codes that is about to sent to the client will be logged, and unnecessary log4j entries to be removed. 3. Also moved some log entries in ReplicationUtils.scala to `trace`: this is rather orthogonal to this PR but I found it rather annoying while debugging the logs. 4. A couple of unrelated bug fixes as pointed by @hachikuji and @apurvam . You can merge this pull request into a Git repository by running: $ git pull https://github.com/guozhangwang/kafka KHotfix-transaction-coordinator-append-callback Alternatively you can review and apply these changes as the patch at: https://github.com/apache/kafka/pull/3287.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #3287 ---- commit 755f01201774f6fb5ddcdff87caaa78634847ebe Author: Guozhang Wang <wangg...@gmail.com> Date: 2017-06-09T23:02:44Z re-prepare transition to completeXX upon retrying append to log ---- --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---