artemlivshits commented on code in PR #19910:
URL: https://github.com/apache/kafka/pull/19910#discussion_r2131102531


##########
core/src/main/scala/kafka/coordinator/transaction/TransactionCoordinator.scala:
##########
@@ -828,7 +828,16 @@ class TransactionCoordinator(txnConfig: TransactionConfig,
 
               nextProducerIdOrErrors.flatMap {
                 nextProducerId =>
-                  Right(coordinatorEpoch, 
txnMetadata.prepareAbortOrCommit(nextState, clientTransactionVersion, 
nextProducerId.asInstanceOf[Long], time.milliseconds(), noPartitionAdded))
+                  // For epoch fence case, we don't want to bump the epoch 
again in prepareAbortOrCommit
+                  // since it was already bumped during the fencing phase to 
avoid double increment
+                  val transactionVersionForCall = if (isEpochFence) {
+                    // Use TV_0 to prevent epoch bump since it was already 
bumped during fencing
+                    TransactionVersion.TV_0

Review Comment:
   Instead of doing this, let's just do something at line 825 -- the TV will 
move forward with KIP-939 and using old version could lead to subtle bugs over 
time.



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