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


##########
core/src/main/scala/kafka/coordinator/transaction/TransactionMetadata.scala:
##########
@@ -380,50 +417,39 @@ private[transaction] class TransactionMetadata(val 
transactionalId: String,
     }
   }
 
-  private def prepareTransitionTo(updatedState: TransactionState,
-                                  updatedProducerId: Long,
-                                  updatedEpoch: Short,
-                                  updatedLastEpoch: Short,
-                                  updatedTxnTimeoutMs: Int,
-                                  updatedTopicPartitions: 
immutable.Set[TopicPartition],
-                                  updatedTxnStartTimestamp: Long,
-                                  updateTimestamp: Long): TxnTransitMetadata = 
{
-    prepareTransitionTo(updatedState, updatedProducerId, 
RecordBatch.NO_PRODUCER_ID, updatedEpoch, updatedLastEpoch, 
updatedTxnTimeoutMs, updatedTopicPartitions, updatedTxnStartTimestamp, 
updateTimestamp, TransactionVersion.TV_0)
-  }
-
-  private def prepareTransitionTo(updatedState: TransactionState,
-                                  updatedProducerId: Long,
-                                  nextProducerId: Long,
-                                  updatedEpoch: Short,
-                                  updatedLastEpoch: Short,
-                                  updatedTxnTimeoutMs: Int,
-                                  updatedTopicPartitions: 
immutable.Set[TopicPartition],
-                                  updatedTxnStartTimestamp: Long,
-                                  updateTimestamp: Long,
-                                  clientTransactionVersion: 
TransactionVersion): TxnTransitMetadata = {
+  private def prepareTransitionTo(state: TransactionState,
+                                  producerId: Long = this.producerId,

Review Comment:
   The defaults just mean that there is no change, so if the caller doesn't use 
an argument, then it remains unchanged for the transition.  I think it makes 
code easier to read than to require every parameter to be specified: the 
changed stuff is easy to see from just glancing at the function call, no need 
to mentally parse which arguments are updated and which stay the same.



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