nicoloboschi opened a new issue, #18802:
URL: https://github.com/apache/pulsar/issues/18802

   ### Search before asking
   
   - [X] I searched in the [issues](https://github.com/apache/pulsar/issues) 
and found nothing similar.
   
   
   ### Version
   
   2.11.0 
   
   ### Minimal reproduce step
   
   Only with `topicLevelPoliciesEnabled=true`
   
   Test case
   
   ```
   @Test
       public void testDeleteNamespaceWithTopicPolicies() throws Exception {
           stopBroker();
           conf.setSystemTopicEnabled(true);
           conf.setTopicLevelPoliciesEnabled(true);
           conf.setForceDeleteNamespaceAllowed(true);
           setup();
   
           String namespace = tenant + "/test-ns2";
           admin.namespaces().createNamespace(namespace, 
Sets.newHashSet("test"));
           admin.topics().createNonPartitionedTopic(namespace + "/topictest");
           admin.namespaces().deleteNamespace(namespace, true);
   ```
   
   ```
   022-12-07T15:27:32,863+0100 [pulsar-io-95-5] WARN  
org.apache.pulsar.broker.service.ServerCnx - Failed to get Partitioned Metadata 
[/127.0.0.1:57885] persistent://test-tenant/test-ns2/__change_events: Namespace 
is deleted
   org.apache.pulsar.broker.web.RestException: Namespace is deleted
   ```
   
   ### What did you expect to see?
   
   The namespace being deleted correctly.
   
   ### What did you see instead?
   
   I get an internal error from the broker.
   
   The issue is that the __change_events topic doesn't exists at the moment of 
the namespace deletion.
   The namespace deletion procedure is:
   - set namespace deleted=true (disallow new topics being created)
   - delete user topics
   - delete system topics
   
   Right after deleting the first topic, the notification of the topic deleted 
is written to the __change_events. If the topic doesn't exists it's created. 
But at this point the topic creation is not allowed.  
   
   I think in case of namespace deletion all the notifications shouldn't be 
written at all since the topic is being deleted.
   
   
   
   ### Anything else?
   
   _No response_
   
   ### Are you willing to submit a PR?
   
   - [ ] I'm willing to submit a PR!


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

Reply via email to