artemlivshits commented on code in PR #17687:
URL: https://github.com/apache/kafka/pull/17687#discussion_r1830027618
##########
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,
+ nextProducerId: Long = this.nextProducerId,
+ producerEpoch: Short = this.producerEpoch,
+ lastProducerEpoch: Short =
this.lastProducerEpoch,
+ txnTimeoutMs: Int = this.txnTimeoutMs,
+ topicPartitions:
immutable.Set[TopicPartition] = this.topicPartitions.toSet,
+ txnStartTimestamp: Long =
this.txnStartTimestamp,
+ txnLastUpdateTimestamp: Long =
this.txnLastUpdateTimestamp,
+ clientTransactionVersion: TransactionVersion
= this.clientTransactionVersion): TxnTransitMetadata = {
Review Comment:
Adding a summary of offline conversations for visibility:
- we'll keep the existing client version in the state unless it needs to be
changed
- we'll update the `completeTransictionTo` to always copy all fields to
eliminate a second decision point for which fields are toing to be update;
having a second decision point is confusing and can lead to bugs
--
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]