rreddy-22 commented on code in PR #23630:
URL: https://github.com/apache/kafka/pull/23630#discussion_r4185954743
##########
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:
> This doesn't solve the problem if the broker is slow to get updated
metadata from the controller
Yes, this is an issue even during writes though. This race condition returns
a stale error even after the replica metadata change takes effect because we
return directly from the cache. That would be a slightly different issue but
open to discussing it as a follow up once we figure out if there's any side
effects, does that sound okay?
##########
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:
> This doesn't solve the problem if the broker is slow to get updated
metadata from the controller
Yes, this is an issue even during writes though. This race condition returns
a stale error even after the replica metadata change takes effect because we
return directly from the cache. That would be a slightly different issue but
open to discussing it as a follow up once we figure out if there's any side
effects, does that sound okay?
--
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]