jolshan commented on code in PR #21735:
URL: https://github.com/apache/kafka/pull/21735#discussion_r4499027204
##########
transaction-coordinator/src/main/java/org/apache/kafka/coordinator/transaction/TxnTransitMetadata.java:
##########
@@ -38,4 +40,36 @@ public record TxnTransitMetadata(
long txnStartTimestamp,
long txnLastUpdateTimestamp,
TransactionVersion clientTransactionVersion
-) { }
+) {
+ private boolean hasNextProducerEpoch() {
+ return nextProducerEpoch != RecordBatch.NO_PRODUCER_EPOCH;
+ }
+
+ // When InitProducerId keeps an Ongoing transaction (which is "prepared"
from
+ // the 2PC protocol perspective) it needs to preserve the producerId /
epoch of
+ // the transaction (that will be used for sending markers), but update the
+ // producerId / epoch that's going to be used by client (so that we could
fence
+ // stale client requests). For backward compatibility (in case of server
+ // downgrade) we keep the producerId / epoch of the transaction in the
+ // producer* fields and the other pair in the nextProducer* fields, so
+ // we have to do a little bit of switcheroo:
Review Comment:
The "switcheroo" comment confused me a bit. `producer*` fields always
represent an ongoing transaction right? It's just when downgrade, we lose the
ability to fence some of the clients bumps with keepPrepared. Is that right?
--
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]