FrankYang0529 commented on code in PR #18735: URL: https://github.com/apache/kafka/pull/18735#discussion_r1934272060
########## clients/src/test/java/org/apache/kafka/clients/admin/KafkaAdminClientTest.java: ########## @@ -1783,12 +1782,14 @@ public void testDescribeTopicsWithDescribeTopicPartitionsApiErrorHandling() thro } } - @Flaky("KAFKA-18441") @Test public void testAdminClientApisAuthenticationFailure() { Cluster cluster = mockBootstrapCluster(); try (final AdminClientUnitTestEnv env = new AdminClientUnitTestEnv(Time.SYSTEM, cluster, - newStrMap(AdminClientConfig.REQUEST_TIMEOUT_MS_CONFIG, "1000"))) { + newStrMap(AdminClientConfig.REQUEST_TIMEOUT_MS_CONFIG, "1000", + // The default "retry.backoff.ms" is 100. if following assertion can't finish in 100L, + // the test will fail. Set it to 5000 to make sure the test can finish in time. + AdminClientConfig.RETRY_BACKOFF_MS_CONFIG, "5000"))) { env.kafkaClient().setNodeApiVersions(NodeApiVersions.create()); env.kafkaClient().createPendingAuthenticationError(cluster.nodes().get(0), TimeUnit.DAYS.toMillis(1)); Review Comment: Hi @AndrewJSchofield and @lianetm, thanks for the review and information. After checking the code again, my PR description is unclear. With default "retry.backoff.ms", if all assertion can't finish in `100L`, the `KafkaAdminClient` make a metadata call again. https://github.com/apache/kafka/blob/048dfeffd0b8dcda01ec8c4c6f110b9d60994b84/clients/src/main/java/org/apache/kafka/clients/admin/KafkaAdminClient.java#L1541-L1550 In the `fetchMetadata` request, it uses `MetadataUpdateNodeIdProvider`. https://github.com/apache/kafka/blob/048dfeffd0b8dcda01ec8c4c6f110b9d60994b84/clients/src/main/java/org/apache/kafka/clients/admin/KafkaAdminClient.java#L1686-L1690 In `MetadataUpdateNodeIdProvider`, it triggers `AdminMetadataManager#rebootstrap`. https://github.com/apache/kafka/blob/048dfeffd0b8dcda01ec8c4c6f110b9d60994b84/clients/src/main/java/org/apache/kafka/clients/admin/KafkaAdminClient.java#L722-L730 Finally, the `rebootstrap` function makes `fatalException` be null again in `AdminMetadataManager#update`. https://github.com/apache/kafka/blob/632aedcf4ff7e718bf1295fe5132ebaf1d3f92a0/clients/src/main/java/org/apache/kafka/clients/admin/internals/AdminMetadataManager.java#L303-L313 This case relies on `AdminMetadataManager#isReady` to throw error. If `fatalException` is null, the assertion can't be fulfilled. https://github.com/apache/kafka/blob/632aedcf4ff7e718bf1295fe5132ebaf1d3f92a0/clients/src/main/java/org/apache/kafka/clients/admin/internals/AdminMetadataManager.java#L186-L190 -- 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