poorbarcode commented on code in PR #18283:
URL: https://github.com/apache/pulsar/pull/18283#discussion_r1011244602
##########
pulsar-broker/src/main/java/org/apache/pulsar/broker/service/persistent/PersistentTopic.java:
##########
@@ -1170,6 +1179,9 @@ private CompletableFuture<Void> delete(boolean
failIfHasSubscriptions,
.map(PersistentSubscription::getName).toList();
return FutureUtil.failedFuture(
new TopicBusyException("Topic has subscriptions did
not catch up: " + backlogSubs));
+ } else if (!closeIfClientsConnected && currentUsageCount() != 0 &&
!failIfHasBacklogs) {
+ return FutureUtil.failedFuture(new TopicBusyException(
+ "Topic has " + currentUsageCount() + " connected
producers/consumers"));
Review Comment:
There is also a concurrency problem that may lead to the incorrect deletion
of existing producer topics. E.g:
| `checkGC` | `new producer registry`|
| --- | --- |
| ensure no producer exists | |
| delete topic ( `false`, `true`, `false`) | |
| ensure no backlog | |
| | new producer registry |
| fence topic | |
| disconnect all clients | |
| delete topic | |
The above flow shows the case: producer exists but the topic is deleted.
Would it be better to add a double-check?
--
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]