mattisonchao opened a new pull request, #21545: URL: https://github.com/apache/pulsar/pull/21545
### Motivation Fix create a topic with different auto creation strategies causes race conditions. the problem happened steps are as follows: (1) Two clients - consumer - admin (2) Admin call `getSubscritpions` and then call broker internal `getTopicIfExists` method. (3) `getTopicIfExists` method will put a future to `topics` map and then try to open the managed ledger. (4) Consumer subscription requests get this future from the `topics` map and then wait for the future result. (5) The topic does not exist. so, it will complete the future with an empty optional object and then trigger the callback. (6) Callback to admin requests to return a 404 HTTP code. (7) Callback to consumer subscription requests to return a topic does not exist exception. But this broker has an auto-creation configuration, so, it doesn't make any sense for the user to receive a topicDoesNotExistException. it should be created automatically. ### Modifications - Retry when requests get an empty topic optional object with createIfMissing=true. ### Verifying this change - [x] Make sure that the change passes the CI checks. ### Documentation <!-- DO NOT REMOVE THIS SECTION. CHECK THE PROPER BOX ONLY. --> - [ ] `doc` <!-- Your PR contains doc changes. --> - [ ] `doc-required` <!-- Your PR changes impact docs and you will update later --> - [x] `doc-not-needed` <!-- Your PR changes do not impact docs --> - [ ] `doc-complete` <!-- Docs have been already added --> -- 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]
