pulsar-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <...@apache.org>
Subject [GitHub] [pulsar] sijie commented on a change in pull request #5572: Fix create consumer on partitioned topic while disable topic auto creation.
Date Wed, 20 Nov 2019 17:02:45 GMT
sijie commented on a change in pull request #5572: Fix create consumer on partitioned topic
while disable topic auto creation.
URL: https://github.com/apache/pulsar/pull/5572#discussion_r348629570
 
 

 ##########
 File path: pulsar-broker/src/main/java/org/apache/pulsar/broker/admin/AdminResource.java
 ##########
 @@ -233,6 +233,23 @@ public void validatePoliciesReadOnlyAccess() {
         return namespaces;
     }
 
+    protected void tryCreatePartitions(int numPartitions) {
+        if (!topicName.isPersistent()) {
+            return;
+        }
+        for (int i = 0; i < numPartitions; i++) {
+            try {
+                zkCreateOptimistic(ZkAdminPaths.managedLedgerPath(topicName.getPartition(i)),
new byte[0]);
+            } catch (KeeperException.NodeExistsException e) {
+                log.warn("[{}] Topic partition is already existing, doing nothing {}", clientAppId(),
topicName.getPartition(i));
+            } catch (KeeperException.BadVersionException e) {
+                log.warn("[{}] Fail to create topic partition {}: concurrent modification",
clientAppId(), topicName.getPartition(i));
 
 Review comment:
   do we need to handle bad version exception and retry the creation?

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services

Mime
View raw message