artemlivshits commented on code in PR #23630:
URL: https://github.com/apache/kafka/pull/23630#discussion_r4189028424


##########
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:
   As far as I can tell allowing committing empty transaction is harmless (and 
we already do it for aborts).  The effect that we'd achieve is that if we're 
doing it on a stale coordinator (that doesn't know it yet), it will get stuck 
trying to replicate until the stale coordinator catches up on metadata and then 
it'll fail with NOT_COORDINATOR error, so the wait for replication naturally 
covers the race condition window.



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