codelipenghui commented on a change in pull request #8442:
URL: https://github.com/apache/pulsar/pull/8442#discussion_r518077827



##########
File path: 
pulsar-broker/src/main/java/org/apache/pulsar/broker/service/persistent/PersistentTopic.java
##########
@@ -1787,6 +1788,32 @@ public void checkGC() {
         }
     }
 
+    private CompletableFuture<Void> deleteZkNode() {
+        CompletableFuture<Void> deleteZkNodeFuture = new CompletableFuture<>();
+        TopicName topicName = TopicName.get(topic);
+        //Only need to delete the ZK node once
+        if (topicName.isPartitioned() && topicName.getPartitionIndex() == 0) {

Review comment:
       There may be problems with this treatment because the partitions of a 
partitioned topic also is an independent topic, the partitions distributed to 
different brokers and each topic may have different producers and consumers(In 
some cases, the client may only connect a few partitions). 
   
   For example, if we have 3 partitions but only partition-0 have no producers, 
the broker will delete the partitioned topic. After that, the new producers or 
consumers will connect to the topic name which is the same as the partition 
topic but this is a different topic.
   
   So it's better to check if all of the partitions are deleted when deleting a 
partitioned topic.
   
   And, I think it's better to provide an option for users in the broker.conf. 
Such as `brokerDeleteInactivePartitionedTopicEnabled` and keep false as the 
default value.
   I proposed this because if the partitioned metadata is deleted 
automatically, the reconnecting client might create partitions again when 
enabling topic auto-creation. This will cause serious problems because the new 
clients will connect to non-partitioned topic(partitioned metadata is delete, 
so the broker will create a non-partitioned topic automatically). This may lead 
to users use the same topic name but unable to pass data.




----------------------------------------------------------------
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.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to