dlg99 commented on code in PR #19153:
URL: https://github.com/apache/pulsar/pull/19153#discussion_r1087345818
##########
pulsar-broker/src/main/java/org/apache/pulsar/broker/service/BrokerService.java:
##########
@@ -1064,6 +1094,13 @@ public CompletableFuture<Optional<Topic>> getTopic(final
TopicName topicName, bo
}
public CompletableFuture<Void> deleteTopic(String topic, boolean
forceDelete) {
+ topicEventsDispatcher.notify(topic, TopicEvent.DELETE,
EventStage.BEFORE);
+ CompletableFuture<Void> result = deleteTopicInternal(topic,
forceDelete);
+ topicEventsDispatcher.notifyOnCompletion(result, topic,
TopicEvent.DELETE);
Review Comment:
One can delete unloaded topic.
From the test, I hope this explains behavior:
```java
@Test
public void testEventsPersistentNonPartitionedTopicForce() throws
Exception {
...
admin.topics().delete(topicNameToWatch, true);
Awaitility.waitAtMost(10, TimeUnit.SECONDS).untilAsserted(() ->
Assert.assertEquals(events.toArray(), new String[]{
"DELETE__BEFORE",
"UNLOAD__BEFORE",
"UNLOAD__SUCCESS",
"DELETE__SUCCESS"
})
);
}
@Test
public void testEventsPersistentNonPartitionedTopicWithUnloadForce()
throws Exception {
...
admin.topics().unload(topicNameToWatch);
Awaitility.waitAtMost(10, TimeUnit.SECONDS).untilAsserted(() ->
Assert.assertEquals(events.toArray(), new String[]{
"UNLOAD__BEFORE",
"UNLOAD__SUCCESS"
})
);
events.clear();
admin.topics().delete(topicNameToWatch, true);
Awaitility.waitAtMost(10, TimeUnit.SECONDS).untilAsserted(() ->
Assert.assertEquals(events.toArray(), new String[]{
"DELETE__BEFORE",
"DELETE__SUCCESS"
})
);
}
```
--
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]