Table of Contents |
---|
Status
Current state: In DiscussionAccepted
Discussion thread: here (Vote thread: here)
JIRA: here
Please keep the discussion on the mailing list rather than commenting on the wiki (wiki discussions get unwieldy fast).
...
Broker will populate this field from txnLastUpdateTime txnLastUpdateTimestamp
contained at TransactionMetadata.
This field is updated at the broker every time the transaction's state changes.
...
Add transactionLastUpdateTimeMs
to TransactionDescription
class. This object is used to build APIResult
at org.apache.kafka.clients.admin.internals.DescribeTransactionsHandler#handleResponse
from DescribeTransactionsResponse
.
We will also add an overloaded public constructor to this class to incorporate the value for transactionLastUpdateTimeMs
field.
Code Block |
---|
package org.apache.kafka.clients.admin; public class TransactionDescription { ... private final OptionalLong transactionLastUpdateTimeMs; ... public TransactionDescription( int coordinatorId, TransactionState state, long producerId, int producerEpoch, long transactionTimeoutMs, OptionalLong transactionStartTimeMs, Set<TopicPartition> topicPartitions ) { new TransactionDescription(coordinatorId, state, producerId, producerEpoch, transactionTimeoutMs, transactionStartTimeMs, OptionalLong.empty(), topicPartitions); } // new overloaded public constructor public TransactionDescription( int coordinatorId, TransactionState state, long producerId, int producerEpoch, long transactionTimeoutMs, OptionalLong transactionStartTimeMs, OptionalLong transactionLastUpdateTimeMs, Set<TopicPartition> topicPartitions ) { ... this.transactionLastUpdateTimeMs = transactionLastUpdateTimeMs; ... } ... public OptionalLong transactionLastUpdateTimeMs() { return transactionLastUpdateTimeMs; } ... } |
...
If TransactionLastUpdateTimeMs field is present in DescribeTransactionsResponse, transaction duration (for completed transactions) will be printed as the difference of TransactionLastUpdateTimeMs and transactionStartTime. On the other hand, if this field is not present, transaction duration value cannot be determined correctly (for completed transactions) and we will print -1.
...
When using a new AdminClient to send durationFilter (value greater than 0) to an older broker, AdminClient will fail to build the ListTransactionsRequest and throw an UnsupportedVersionException. This check will be made at ListTransactionsRequest.Builder.build(short version) method. A new AdminClient can still generate older version of ListTransactionsRequest when user sets durationFilter to 0 (or does not set a durationFilter).
...