You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jira@kafka.apache.org by GitBox <gi...@apache.org> on 2023/01/19 17:58:20 UTC

[GitHub] [kafka] hachikuji commented on a diff in pull request #13129: KAFKA-14638: Elaborate when transaction.timeout.ms resets

hachikuji commented on code in PR #13129:
URL: https://github.com/apache/kafka/pull/13129#discussion_r1081629522


##########
clients/src/main/java/org/apache/kafka/clients/producer/ProducerConfig.java:
##########
@@ -319,6 +319,7 @@ public class ProducerConfig extends AbstractConfig {
     /** <code> transaction.timeout.ms </code> */
     public static final String TRANSACTION_TIMEOUT_CONFIG = "transaction.timeout.ms";
     public static final String TRANSACTION_TIMEOUT_DOC = "The maximum amount of time in ms that the transaction coordinator will wait for a transaction status update from the producer before proactively aborting the ongoing transaction." +
+            "The transaction status update happens on the first producer send, on adding new partitions to the transaction, and on commit. " +

Review Comment:
   I think this configuration is a bit misleading as currently documented. It looks to me like the implementation computes the timeout from the start of the transaction (i.e. the first call to `AddPartitionsToTxn`). We use `txnStartTimestamp` for this purpose here: https://github.com/apache/kafka/blob/trunk/core/src/main/scala/kafka/coordinator/transaction/TransactionStateManager.scala#L134. This value is only updated on the initial transition to the `Ongoing` state: https://github.com/apache/kafka/blob/trunk/core/src/main/scala/kafka/coordinator/transaction/TransactionMetadata.scala#L331. 
   
   I'd suggest we rephrase this configuration to something like this:
   > The maximum amount of time in milliseconds that a transaction will remain open before the coordinator proactively aborts. The start of the transaction is set at the time that the first partition is added to it. If this value is larger than the transaction.max.timeout.ms setting in the broker, the request will fail with a <code>InvalidTxnTimeoutException</code> error.



-- 
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-unsubscribe@kafka.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org