You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by GitBox <gi...@apache.org> on 2022/08/14 11:21:01 UTC

[GitHub] [pulsar] leizhiyuan opened a new issue, #17087: [Bug] when delete namespace bundle-data in metastore was not deleted

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

   ### Search before asking
   
   - [X] I searched in the [issues](https://github.com/apache/pulsar/issues) and found nothing similar.
   
   
   ### Version
   
   master branch
   
   ### Minimal reproduce step
   
   just add a test case 
   org.apache.pulsar.broker.namespace.NamespaceServiceTest
   
   testModularLoadManagerRemoveBundleAndLoad
   
   ```
    @Test
       public void testModularLoadManagerRemoveBundleAndLoad() throws Exception {
           final String BUNDLE_DATA_PATH = "/loadbalance/bundle-data";
           final String namespace = "prop/ns-abc";
           final String topic1 = "persistent://" + namespace + "/topic1";
           final String topic2 = "persistent://" + namespace + "/topic2";
   
           // configure broker with ModularLoadManager
           conf.setLoadManagerClassName(ModularLoadManagerImpl.class.getName());
           conf.setForceDeleteNamespaceAllowed(true);
           restartBroker();
   
           LoadManager loadManager = spy(pulsar.getLoadManager().get());
           Field loadManagerField = NamespaceService.class.getDeclaredField("loadManager");
           loadManagerField.setAccessible(true);
           doReturn(true).when(loadManager).isCentralized();
           SimpleResourceUnit resourceUnit = new SimpleResourceUnit(pulsar.getSafeWebServiceAddress(), null);
        //   Optional<ResourceUnit> res = Optional.of(resourceUnit);
       //    doReturn(res).when(loadManager).getLeastLoaded(any(ServiceUnitId.class));
           loadManagerField.set(pulsar.getNamespaceService(), new AtomicReference<>(loadManager));
   
   
           NamespaceName nsname = NamespaceName.get(namespace);
   
           @Cleanup
           PulsarClient pulsarClient = PulsarClient.builder().serviceUrl(pulsar.getBrokerServiceUrl()).build();
           @Cleanup
           Consumer<byte[]> consumer1 = pulsarClient.newConsumer().topic(topic1)
                   .subscriptionName("my-subscriber-name1").subscribe();
           @Cleanup
           Consumer<byte[]> consumer2 = pulsarClient.newConsumer().topic(topic2)
                   .subscriptionName("my-subscriber-name2").subscribe();
   
   
           NamespaceBundle bundle =
                   pulsar.getNamespaceService().getNamespaceBundleFactory().getBundle(TopicName.get(topic1));
   
           loadManager.getLeastLoaded(bundle);
   
           //create znode for bundle-data
           pulsar.getBrokerService().updateRates();
           loadManager.writeLoadReportOnZookeeper();
           loadManager.writeResourceQuotasToZooKeeper();
   
           String path = BUNDLE_DATA_PATH + "/" + nsname.toString() + "/0x00000000_0xffffffff";
   
           Optional<GetResult> getResult = pulsar.getLocalMetadataStore().get(path).get();
           assertTrue(getResult.isPresent());
   
   
           //delete namespace which will remove bundle and load
           pulsar.getAdminClient().namespaces().deleteNamespace(nsname.toString(),true);
   
           TimeUnit.SECONDS.sleep(5);
           getResult = pulsar.getLocalMetadataStore().get(path).get();
           assertFalse(getResult.isPresent());
   
           // update broker bundle report to zk
           loadManager.writeLoadReportOnZookeeper();
           loadManager.writeResourceQuotasToZooKeeper();
   
           getResult = pulsar.getLocalMetadataStore().get(path).get();
           assertTrue(getResult.isPresent());
   
       }
   ```
   
   ### What did you expect to see?
   
   after delete namespace 
   
   ```
      getResult = pulsar.getLocalMetadataStore().get(path).get();
           assertFalse(getResult.isPresent());
   ```
   
   
   ### What did you see instead?
   
   true
   
   ### 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: commits-unsubscribe@pulsar.apache.org.apache.org

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


[GitHub] [pulsar] leizhiyuan closed issue #17087: [Bug] when delete namespace bundle-data in metastore was not deleted

Posted by GitBox <gi...@apache.org>.
leizhiyuan closed issue #17087: [Bug] when delete namespace bundle-data in metastore was not deleted 
URL: https://github.com/apache/pulsar/issues/17087


-- 
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: commits-unsubscribe@pulsar.apache.org

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


[GitHub] [pulsar] leizhiyuan commented on issue #17087: [Bug] when delete namespace bundle-data in metastore was not deleted

Posted by GitBox <gi...@apache.org>.
leizhiyuan commented on issue #17087:
URL: https://github.com/apache/pulsar/issues/17087#issuecomment-1214748829

   <img width="1484" alt="image" src="https://user-images.githubusercontent.com/2684384/184601909-0c861a04-dd0c-4189-a4e7-3f8bc763d3f5.png">
   BundleStats was not deleted ,then task will rewrite the bundle data again


-- 
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: commits-unsubscribe@pulsar.apache.org

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