Hi guys. This is the refined PIP-242 discussion thread. Because we have discussed some parts of this in another thread[0][1], we can start the standard PIP discussion to reach a detailed consensus.
You can check here[2] to see the PIP. Best, Mattison [0] https://lists.apache.org/thread/5s4kop7qmxgpvsnh65s42r9mv7qc1pxt [1] https://lists.apache.org/thread/km7jp26zmnfj6t3hpq0rt77j7wvn45o6 [2] https://github.com/apache/pulsar/issues/19239 ---------- Paste the document to help quotes ---------- ### Motivation Currently, the Apache Pulsar has no restrictions on the topic name. Even `system topics`, `partitioned topics` etc. which is confusing for our developers to identify whether this is a partition of a partitioned topic. Plus, we need to add more logic to be compatible with this special topic name. for example: - https://github.com/apache/pulsar/pull/19240 - https://github.com/apache/pulsar/pull/19230 - https://github.com/apache/pulsar/pull/19171 - https://github.com/apache/pulsar/pull/19086 - ... ### Goal This proposal aimed to add more restrictions for a topic name. that includes three parts as follows: 1. Using `NamedEntity` to validate the topic name characters. 2. Make the `-partition-` string the keyword. That allows the user to use it when it's a partitioned topic. 3. Introduce the new system topic structure. `__SYS__<name>__` **Create a topic:** _no corresponding partitioned topic_ - persistent://public/default/local-name (passed) - persistent://public/default/local-name-partition-z (rejected by keyword) - persistent://public/default/local-name-partition-0 (rejected by keyword) _Has corresponding partitioned topic, **partitions=2** and topic partition name is **persistent://public/default/local-name**_ - persistent://public/default/local-name-partition-0 (passed, Because it is the partition topic's sub-partition) - persistent://public/default/local-name-partition-z (rejected by keyword) - persistent://public/default/local-name-partition-4 (rejected, Because it exceeds the number of maximum partitions) **Create a partitioned topic(topic metadata)** - persistent://public/default/local-name (passed) - persistent://public/default/local-name-partition-z (rejected by keyword) - persistent://public/default/local-name-partition-0 (rejected by keyword) ### Compatibility We will introduce the new configuration `enableStrictTopicName` to support compatibility. Users can easily disable it to get rid of the restrictions. For the system topic names, I would like to keep the original names and introduce a new topic structure `__SYS__<name>__` ### API Changes Add a new configuration, `enableStrictTopicName=false`. ### Implementation 1. Add configuration `enableStrictTopicName=false` and make it dynamic. 2. Add topic name validation by `NamedEntity` 3. Add partitioned topic rejection logic. 4. Add warning logs to inform users that we do not recommend creating topics that name with the restrictions name when users disable `enableStrictTopicName`. 5. Make `enableStrictTopicName=true` in the next major release. and mark that this config will be removed in the future.