codelipenghui opened a new pull request, #16676: URL: https://github.com/apache/pulsar/pull/16676
Fixes #16669 ### Motivation The root cause is a race condition between namespace deletion and topic creation. https://github.com/apache/pulsar/blob/3d4fa00b0059744c3d945c77672b9769c335014c/pulsar-broker/src/main/java/org/apache/pulsar/broker/admin/impl/NamespacesBase.java#L296-L306 The delete namespace operation has checked the topic list but hasn't changed the znode. https://github.com/apache/pulsar/blob/3d4fa00b0059744c3d945c77672b9769c335014c/pulsar-broker/src/main/java/org/apache/pulsar/broker/web/PulsarWebResource.java#L869-L874 The new topic passed this check and continues to create the topic. While deleting the namespace bundle, the newly created topic will be present in the topic list https://github.com/apache/pulsar/blob/3d4fa00b0059744c3d945c77672b9769c335014c/pulsar-broker/src/main/java/org/apache/pulsar/broker/admin/impl/NamespacesBase.java#L620-L642 So the delete namespace operation failed. ### Modifications The simple fix is if we get a ConflictException while deleting the namespace, which means the delete namespace operation detected a race condition. For the new loaded system topic, the namespace delete operation will continue. For non-system topic, the operation will fail with can't to delete non-empty namespace. ### Documentation Check the box below or label this PR directly. Need to update docs? - [ ] `doc-required` (Your PR needs to update docs and you will update later) - [x] `doc-not-needed` (Please explain why) - [ ] `doc` (Your PR contains doc changes) - [ ] `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]
