BewareMyPower opened a new pull request #9342:
URL: https://github.com/apache/pulsar/pull/9342
### Motivation
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.
By the way, when a `AdminResource` was created with a full topic name, the
internal `topicName` would be initialized with a wrong name. e.g. for
`persistent://public/default/my-topic`, the internal `topicName` is
`persistent://public/default/persistent://public/default/my-topic`. This wrong
behavior should be fixed.
### Modifications
- Fix the wrong behavior of `AdminResource#validateTopicName`.
- When creating a non-partition topic that is an existed partition, throw a
`RestException` and add a test to verify it.
### Verifying this change
- [ ] Make sure that the change passes the CI checks.
This change added tests and can be verified as follows:
- *Added PersistentTopics#testCreateExistedPartition*
----------------------------------------------------------------
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]