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


##########
core/src/main/scala/kafka/coordinator/transaction/TransactionMetadata.scala:
##########
@@ -333,16 +333,17 @@ private[transaction] class TransactionMetadata(val 
transactionalId: String,
       (topicPartitions ++ addedTopicPartitions).toSet, newTxnStartTimestamp, 
updateTimestamp)
   }
 
-  def prepareAbortOrCommit(newState: TransactionState, 
clientTransactionVersion: TransactionVersion, nextProducerId: Long, 
updateTimestamp: Long): TxnTransitMetadata = {
+  def prepareAbortOrCommit(newState: TransactionState, 
clientTransactionVersion: TransactionVersion, nextProducerId: Long, 
updateTimestamp: Long, isEmptyAbort: Boolean): TxnTransitMetadata = {
     val (updatedProducerEpoch, updatedLastProducerEpoch) = if 
(clientTransactionVersion.supportsEpochBump()) {
       // We already ensured that we do not overflow here. MAX_SHORT is the 
highest possible value.
       ((producerEpoch + 1).toShort, producerEpoch)
     } else {
       (producerEpoch, lastProducerEpoch)
     }
 
+    val newTxnStartTimestamp = if (isEmptyAbort) updateTimestamp else 
txnStartTimestamp

Review Comment:
   can we leave a comment explaining this? It might be confusing to those who 
don't know this code.



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