jiazhai commented on issue #1383: Unable to delete partitioned metadata for a 
partitioned topic
URL: 
https://github.com/apache/incubator-pulsar/issues/1383#issuecomment-405918077
 
 
    @cckellogg. Seems this is function as designed.
   
   Added a Test case for this 
   ```
       public void testIssue1383() throws Exception {
           String key = "testIssue1383";
           final String subscriptionName = "my-ex-subscription-" + key;
   
           final String topicName = "persistent://prop/use/ns-abc2/topic-" + 
key;
   
           admin.tenants().createTenant("prop", new TenantInfo());
           admin.topics().createPartitionedTopic(topicName, 2);
   
           // 2. Create consumer
           try {
               pulsarClient.newConsumer()
                   .topic(topicName)
                   .subscriptionName(subscriptionName)
                   .subscriptionType(SubscriptionType.Shared)
                   .ackTimeout(ackTimeOutMillis, TimeUnit.MILLISECONDS)
                   .subscribe();
   
               admin.topics().deletePartitionedTopic(topicName, true);   < ===
           } catch (Exception e) {
               log.error("Exception ", e);
           }
       }
   ```
   
   In the line `< ===`, while using   
`admin.topics().deletePartitionedTopic(topicName)`,   It will report:
   ```
   
org.apache.pulsar.client.admin.PulsarAdminException$PreconditionFailedException:
 Topic has active producers/subscriptions
   ```
   
   If  use force delete, which means set the second paramter to true, 
`admin.topics().deletePartitionedTopic(topicName, true)`, It get deleted 
success.
   

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to