artemlivshits commented on code in PR #17687:
URL: https://github.com/apache/kafka/pull/17687#discussion_r1828614890
##########
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:
Good question. I don't think KIP-939 would rely on persisted value of
client version, we should be able to just look at the values of the fields
(nextProducerId, nextProducerEpoch) and figure out what logic needs to be done.
But it's a good point that this change actually makes the clientVersion
"sticky" in the sense that once it's set it'll keep the value during the
transitions. Maybe to keep this change completely mechanical, transition to
ongoing or empty should reset the version to TV_0.
--
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]