CalvinConfluent commented on code in PR #17698:
URL: https://github.com/apache/kafka/pull/17698#discussion_r1854568831


##########
core/src/main/scala/kafka/coordinator/transaction/TransactionCoordinator.scala:
##########
@@ -498,6 +498,45 @@ class TransactionCoordinator(txnConfig: TransactionConfig,
       requestLocal)
   }
 
+  /*
+    The state transition for Empty, CompleteAbort, CompleteCommit is 
complicated, so here is a table to make it clear.
+    Note:
+    PF = PRODUCER_FENCED
+    ITS = INVALID_TXN_STATE
+    NONE = No error and no epoch bump
+    EB = No error and epoch bump
+
+    Retry => producerEpoch = txnState.ProducerEpoch - 1
+    Current => producerEpoch = txnState.ProducerEpoch
+    ------------------------------------------------------
+    With transaction V1.
+    +----------------+-----------------+-----------------+
+    |                | Abort           | Commit          |
+    +----------------+-------+---------+-------+---------+
+    |                | Retry | Current | Retry | Current |
+    +----------------+-------+---------+-------+---------+
+    | Empty          | PF    | ITS     | PF    | ITS     |
+    +----------------+-------+---------+-------+---------+
+    | CompleteAbort  | PF    | NONE    | PF    | ITS     |
+    +----------------+-------+---------+-------+---------+
+    | CompleteCommit | PF    | ITS     | PF    | NONE    |
+    +----------------+-------+---------+-------+---------+
+
+    With transaction V2.
+    +----------------+-----------------+-----------------+
+    |                | Abort           | Commit          |
+    +----------------+-------+---------+-------+---------+
+    |                | Retry | Current | Retry | Current |
+    +----------------+-------+---------+-------+---------+
+    | Empty          | PF    | EB      | ITS   | ITS     |

Review Comment:
   Retry is a very special type of epoch not match which is current epoch - 1. 
I guess it can happen if the client does not receive the response.
   
   > For commit, the "retry" case is "PF".
   
   Why is that? I think the server can return the current epoch to the client 
right? The client may just resend a commit request.



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