rreddy-22 commented on code in PR #23630:
URL: https://github.com/apache/kafka/pull/23630#discussion_r4199899386


##########
core/src/main/scala/kafka/coordinator/transaction/TransactionStateManager.scala:
##########
@@ -391,6 +391,14 @@ class TransactionStateManager(brokerId: Int,
     })
   }
 
+  /**
+   * Check whether this broker still leads the given transaction state 
partition at the given coordinator epoch.
+   * The cache entry is only removed on resignation, which happens after the 
replica becomes a follower.
+   */
+  private def isCoordinatorFor(partitionId: Int, coordinatorEpoch: Int): 
Boolean =
+    replicaManager.onlinePartition(new 
TopicPartition(Topic.TRANSACTION_STATE_TOPIC_NAME, partitionId))

Review Comment:
   I think that makes sense, I'd still like to keep the current check, since it 
covers the window after the replica has applied the change but before the cache 
is unloaded. In that window, any answer served from the cache can be stale 
(INVALID_TXN_STATE, PRODUCER_FENCED, verification), and this turns them all 
into NOT_COORDINATOR.
   For the metadata-lag case that you brought up, I can implement your 
suggestion of allowing an empty commit on TV2, handled the same way as empty 
abort, so a stale coordinator can't complete the write. I think we could do it 
in a follow up cause we would want to track a state machine change better or we 
can do it here
   



-- 
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]

Reply via email to