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

   ### Search before asking
   
   - [X] I searched in the [issues](https://github.com/apache/pulsar/issues) 
and found nothing similar.
   
   
   ### Read release policy
   
   - [X] I understand that unsupported versions don't get bug fixes. I will 
attempt to reproduce the issue on a supported version of Pulsar client and 
Pulsar broker.
   
   
   ### Version
   
   Pulsar version: master 15b88d2
   
   ### Minimal reproduce step
   
   Add the following tests to `ShadowTopicRealBkTest`
   
   ```java
       public void test() throws Exception {
           final var sourceTopic = 
TopicName.get("test-read-from-source").toString();
           final var shadowTopic = sourceTopic + "-shadow";
   
           admin.topics().createNonPartitionedTopic(sourceTopic);
           admin.topics().createShadowTopic(shadowTopic, sourceTopic);
           admin.topics().setShadowTopics(sourceTopic, 
Lists.newArrayList(shadowTopic));
   
           Awaitility.await().atMost(5, TimeUnit.SECONDS).untilAsserted(()->{
               final var sourcePersistentTopic = (PersistentTopic) 
pulsar.getBrokerService()
                       .getTopicIfExists(sourceTopic).get().orElseThrow();
               final var replicator = (ShadowReplicator) 
sourcePersistentTopic.getShadowReplicators().get(shadowTopic);
               Assert.assertNotNull(replicator);
               Assert.assertEquals(String.valueOf(replicator.getState()), 
"Started");
           });
           admin.topics().delete(shadowTopic);
           admin.topics().delete(sourceTopic);
       }
   ```
   
   ### What did you expect to see?
   
   The tests passed
   
   ### What did you see instead?
   
   The tests failed because of the shadow replicators have producers and 
readers registered to the shadow topic and the source topic.
   
   ```
   
org.apache.pulsar.client.admin.PulsarAdminException$PreconditionFailedException:
 Topic has 1 connected producers/consumers
   ```
   
   ### Anything else?
   
   Even if we delete these topics by force, the shadow replicator will not be 
cleared correctly.
   
   ### Are you willing to submit a PR?
   
   - [X] 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