forked from apache/pulsar
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Validate topic name before creating partition/non partition topic via…
… admin cli. (apache#5148) fix apache#4994 For non partition topic, Topic name contains partition suffix "-partition-" and the remaining part follow the partition suffix is numeric value larger than the number of partition if there's already a partition topic with same name(the part before suffix "-partition-"). 2)Topic name contains partition suffix "-partition-" and the remaining part follow the partition suffix is numeric value but there isn't a partitioned topic with same name. For partition topic, Validation will fail and throw RestException if There's already a partitioned topic with same topic name and have some of its partition created. There's already non partition topic with same name and contains partition suffix "-partition-" followed by numeric value. In this case internal created partition of partitioned topic could override the existing non partition topic. This is for non partition topic created before we enforce the check as we will prevent creation of non partition topic with such name which could lost of confusion. For update partition topic, Validation will fail if there's already non partition topic with same name and contains partition suffix "-partition-" followed by numeric value X then the new number of partition of that partitioned topic can not be greater than that X else that non partition topic will essentially be overwritten and cause unexpected consequence. Also removed TopicsConsumerImplTest#testTopicAutoUpdatePartitions in flavor of PartitionedProducerConsumerTest#testAutoUpdatePartitionsForProducerConsumer, as they're both testing auto partition update to consumer/producer. But TopicsConsumerImplTest#testTopicAutoUpdatePartitions was trying to manually create non partitioned topic with name like "xyz-topic-partition-5" by creating new producer of that topic, while 5 is larger than a existing partitioned topic xyz-topic's actual number of partition. Which make the validation fails and shouldn't be encouraged.
- Loading branch information
Showing
8 changed files
with
226 additions
and
40 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.