You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by GitBox <gi...@apache.org> on 2021/01/28 00:57:13 UTC

[GitHub] [pulsar] zymap commented on pull request #9342: Fix create partition of a exist topic doesn't throw RestException

zymap commented on pull request #9342:
URL: https://github.com/apache/pulsar/pull/9342#issuecomment-768679642


   > By the way, when a AdminResource was created with a full topic name, the internal topicName would be initialized with a wrong name. eg for persistent://public/default/my-topic, the internal topicName is persistent://public /default/persistent://public/default/my-topic. This wrong behavior should be fixed.
   
   I am curious about this, when will this behavior happen? As I know, the rest API is defined as `tenant/namespace/topicname`. So that means this case will happen when you name your topic name as `persistent://public /default/topic` explicitly.
   
   > Currently creating a partition of an existed partitioned topic was created doesn't throw any exception. However it should be an invalid behavior. The reason is that when a non partitioned topic was created, it only checks whether the number of partitions is positive. However, no matter the topic doesn't exist or the topic is an existed partition, the number of partitions is 0. This PR is to distinguish these two cases and throw a RestException when the non-partitioned topic is an existed partition.
   
   About this issue, I am using master code to test and it shows I can't create a non-partitioned topic with a name that contains the `-partition-`
   
   ```
    bin/pulsar-admin topics create persistent://public/default/tttest-partition-0
   08:46:49.633 [AsyncHttpClient-7-1] WARN  org.apache.pulsar.client.admin.internal.BaseResource - [http://localhost:8080/admin/v2/persistent/public/default/tttest-partition-0] Failed to perform http put request: javax.ws.rs.ClientErrorException: HTTP 412 Precondition Failed
   Can't create topic tttest-partition-0 with "-partition-" followed by numeric value if there isn't a partitioned topic tttest created.
   
   Reason: Can't create topic tttest-partition-0 with "-partition-" followed by numeric value if there isn't a partitioned topic tttest created.
   ```
   
   So could you please give me more information about this case?


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