jolshan commented on code in PR #16719:
URL: https://github.com/apache/kafka/pull/16719#discussion_r1722502474


##########
core/src/main/scala/kafka/coordinator/transaction/TransactionCoordinator.scala:
##########
@@ -668,11 +709,23 @@ class TransactionCoordinator(txnConfig: TransactionConfig,
     }
   }
 
+  def isInvalidTxnTransition(txnMetadata: TransactionMetadata, 
txnMarkerResult: TransactionResult) = {
+    !((List(PrepareCommit, CompleteCommit).contains(txnMetadata.state) && 
txnMarkerResult == TransactionResult.COMMIT) ||
+      (List(PrepareAbort, CompleteAbort).contains(txnMetadata.state) && 
txnMarkerResult == TransactionResult.ABORT))
+  }
+
+  def isRetryEndTxn(txnMetadata: TransactionMetadata, producerId: Long, 
producerEpoch: Short): Boolean = {
+    // The previous producer ID matches and the epoch is either + 1 the 
request epoch or 0 if the epoch overflowed.

Review Comment:
   I think if we want to redo the epoch check with the state transitions we can 
cover this. My only concern is if that ordering messes with the old handling. I 
will look into that
   



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to