akhileshchg commented on code in PR #12961:
URL: https://github.com/apache/kafka/pull/12961#discussion_r1050063855
##########
core/src/main/scala/kafka/server/MetadataCache.scala:
##########
@@ -103,13 +110,18 @@ trait MetadataCache {
def metadataVersion(): MetadataVersion
def features(): FinalizedFeaturesAndEpoch
+
+ def getRandomAliveBrokerId: Option[Int]
Review Comment:
Returning an `Option[Node]` doesn't really solve the problem of checking the
type of controller. The real problem is this: We query metadataCache 1) either
for a real kraft controller (to build communication channels, for ex.) or 2)
for a random broker if we have a kraft controller (to respond to metadata and
describe cluster requests).
I initially had two different functions returning either real controller id
or random broker id in the case of kraft controller. This will help reduce
type-checking outside this class. But Coling advised against this.
--
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]