dengziming commented on code in PR #12206: URL: https://github.com/apache/kafka/pull/12206#discussion_r886641824
########## core/src/test/scala/integration/kafka/server/KRaftClusterTest.scala: ########## @@ -725,4 +725,35 @@ class KRaftClusterTest { cluster.close() } } + + @Test + def testDescribeQuorumRequestToBrokers() : Unit = { + val cluster = new KafkaClusterTestKit.Builder( + new TestKitNodes.Builder(). + setNumBrokerNodes(4). + setNumControllerNodes(3).build()).build() + try { + cluster.format + cluster.startup + for (i <- 0 to 3) { + TestUtils.waitUntilTrue(() => cluster.brokers.get(i).brokerState == BrokerState.RUNNING, + "Broker Never started up") + } + val props = cluster.clientProperties() + props.put(AdminClientConfig.CLIENT_ID_CONFIG, this.getClass.getName) + val admin = Admin.create(props) + try { + val quorumState = admin.describeMetadataQuorum(new DescribeMetadataQuorumOptions) + val quorumInfo = quorumState.quorumInfo().get() + + assertEquals(KafkaRaftServer.MetadataTopic, quorumInfo.topic()) + assertEquals(3, quorumInfo.voters.size()) + assertEquals(0, quorumInfo.observers.size()) Review Comment: I find the cause here, We set nodeId=-1 if it's a broker so observers.size==0 https://github.com/apache/kafka/blob/4c9eeef5b2dff9a4f0977fbc5ac7eaaf930d0d0e/core/src/main/scala/kafka/raft/RaftManager.scala#L185-L189 I changed it to `val nodeId = OptionalInt.of(config.nodeId)`, then observers.size==4 -- 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: jira-unsubscr...@kafka.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org