showuon opened a new pull request #10185:
URL: https://github.com/apache/kafka/pull/10185


   The reason why the test sometimes failed with: `TopicExistsException: Topic 
'primary.test-topic-2' already exists.` is because we tried to create the topic 
that the MM2 already help us created. That is, 
   ```java
   primary.kafka().createTopic("test-topic-2", NUM_PARTITIONS);
   // after the primary cluster created "test-topic-2" topic, the backup 
cluster will auto-created the topic: "primary.test-topic-2" for us
   backup.kafka().createTopic("primary.test-topic-2", 1); // this line will 
have race condition with the MM2
   ```
   
   Fix the issue by explicitly waiting for the MM2 auto-created topic. Also fix 
2 issues in the tests:
   1. We should handle delete topics exception well
   2. We had resource leak due to no close the adminClient
   
   ### Committer Checklist (excluded from commit message)
   - [ ] Verify design and implementation 
   - [ ] Verify test coverage and CI build status
   - [ ] Verify documentation (including upgrade notes)
   


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

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Reply via email to