[Bug] Partition topic cannot be matched using regex
- Dominant language
- Java
- Stars
- 15.3k
- Forks
- 3.8k
- Avg merge
- 1d 14h
- Merged PRs (30d)
- 160
Description
### Search before asking
- [X] I searched in the [issues](https://github.com/apache/pulsar/issues) and found nothing similar.
### Version
pulsarVersion:3.0.0
pulsarClientVersion:3.0.0
### Minimal reproduce step
When the server receives a request of type GET_TOPICS_OF_NAMESPACE, it will return the Topic and perform regular matching
However, the returned Topic contains the "-partition-0" partition suffix, but when matching again, the partition suffix is not removed
```java
getBrokerService().pulsar().getNamespaceService().getListOfTopics(namespaceName, mode)
.thenAccept(topics -> {
boolean filterTopics = false;
// filter system topic
List filteredTopics = TopicList.filterSystemTopic(topics);
if (enableSubscriptionPatternEvaluation && topicsPattern.isPresent()) {
if (topicsPattern.get().length() <= maxSubscriptionPatternLength) {
filterTopics = true;
filteredTopics = TopicList.filterTopics(filteredTopics, topicsPattern.get());
} else {
log.info("[{}] Subscription pattern provided was longer than maximum {}.",
remoteAddress, maxSubscriptionPatternLength);
}
}
}
```
Let's take a look filterSystemTopic
```java
List filteredTopics = TopicList.filterSystemTopic(topics);
public static List filterSystemTopic(List original) {
return original.stream()
.filter(topic -> !SystemTopicNames.isSystemTopic(TopicName.get(topic)))
.collect(Collectors.toList());
}
public static boolean isSystemTopic(TopicName topicName) {
TopicName nonPartitionedTopicName = TopicName.get(topicName.getPartitionedTopicName());
return isEventSystemTopic(nonPartitionedTopicName) || isTransactionInternalName(nonPartitionedTopicName);
}
```
### What did you expect to see?
Hope that the matching topic can be removed from the partition suffix
### What did you see instead?
The matching topic does not remove the partition suffix
### Anything else?
_No response_
### Are you willing to submit a PR?
- [X] I'm willing to submit a PR!
Contributor guide
Assessment
This issue has not been assessed yet.