-
Notifications
You must be signed in to change notification settings - Fork 3.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
maxTopicsPerNamespace check should exclude system topic. #10850
Conversation
Signed-off-by: YANGLiiN <ielin@qq.com>
This comment was marked by me. Though it's a wrong behavior, like |
pulsar-common/src/main/java/org/apache/pulsar/common/naming/TopicName.java
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done.
pulsar-common/src/main/java/org/apache/pulsar/common/naming/TopicName.java
Outdated
Show resolved
Hide resolved
Could you add a test case to cover your change? Your test only covers the I mean changing |
done. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
@yangl thanks for your contribution. For this PR, do we need to update docs? |
No, it doesn't involve docs. |
/pulsarbot run-failure-checks |
pulsar-broker/src/main/java/org/apache/pulsar/broker/systopic/SystemTopicClient.java
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree that system topics shouldn't count against the max topic limit per namespace. I left some comments for potential edge cases that I think need to be considered.
pulsar-broker/src/main/java/org/apache/pulsar/broker/systopic/SystemTopicClient.java
Outdated
Show resolved
Hide resolved
pulsar-broker/src/main/java/org/apache/pulsar/broker/service/BrokerService.java
Show resolved
Hide resolved
pulsar-broker/src/main/java/org/apache/pulsar/broker/admin/AdminResource.java
Show resolved
Hide resolved
# Conflicts: # pulsar-common/src/main/java/org/apache/pulsar/common/events/EventsTopicNames.java
@315157973 @michaeljmarshall Could you take a look again? |
@315157973 @michaeljmarshall Could you take a look again? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@yangl - thanks for addressing my initial comments. Those changes look good. I left some comments on optimizations I think we should implement.
pulsar-common/src/main/java/org/apache/pulsar/common/events/EventsTopicNames.java
Outdated
Show resolved
Hide resolved
pulsar-broker/src/main/java/org/apache/pulsar/broker/systopic/SystemTopicClient.java
Outdated
Show resolved
Hide resolved
return EventsTopicNames.NAMESPACE_EVENTS_LOCAL_NAME.equals(topicName.getLocalName()); | ||
String localName = TopicName.get(topicName.getPartitionedTopicName()).getLocalName(); | ||
// transaction pending ack topic | ||
if (StringUtils.endsWith(localName, MLPendingAckStore.PENDING_ACK_STORE_SUFFIX)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@sijie - I am concerned that this logic technically includes user topics. That technically leaves users open to accidentally (or intentionally) creating topics that could be classified as system topics. Given the change in this PR, letting a topic end in this special suffix could allow users to create topics and exceed a namespace's topic limit (assuming the limit is enabled). I don't think this comment should prevent us from merging this PR, but I do think we should address this concern at some point.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@sijie Could you take a look at @michaeljmarshall 's comment?
BTW, I'll merge this PR first.
Signed-off-by: YANGLiiN <ielin@qq.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@yangl - thanks for addressing my comments. LGTM.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
### Motivation The current maxTopicsPerNamespace check logic contains system topics, but it should be excluded. As the even if we turn off `allowAutoTopicCreation`, the systemtopic will auto creation too. ### Modifications 1. Exclude the system topics for the maxTopicsPerNamespace logic. 2. SystemTopic add the missed logic, such as `__transaction_buffer_snapshot` 、start with the `__transaction_buffer_snapshot` end with the `__transaction_pending_ack`. In addition, why is mytopic-partition--1 is a partitioned topic(with --)? Which version of us uses this logic? ```java // NOTE: Following behavior is not right actually, but for the backward compatibility, it shouldn't be changed assertEquals(TopicName.getPartitionIndex("mytopic-partition--1"), 1); assertEquals(TopicName.getPartitionIndex("mytopic-partition-00"), 0); assertEquals(TopicName.getPartitionIndex("mytopic-partition-012"), 12); ``` this testcase added with apache@dd8be83#diff-445b0cfa56ca0c784df78e73d9294f2a37f079ca3c15c345b03c09d56f81ebffR204 by @BewareMyPower
### Motivation The current maxTopicsPerNamespace check logic contains system topics, but it should be excluded. As the even if we turn off `allowAutoTopicCreation`, the systemtopic will auto creation too. ### Modifications 1. Exclude the system topics for the maxTopicsPerNamespace logic. 2. SystemTopic add the missed logic, such as `__transaction_buffer_snapshot` 、start with the `__transaction_buffer_snapshot` end with the `__transaction_pending_ack`. In addition, why is mytopic-partition--1 is a partitioned topic(with --)? Which version of us uses this logic? ```java // NOTE: Following behavior is not right actually, but for the backward compatibility, it shouldn't be changed assertEquals(TopicName.getPartitionIndex("mytopic-partition--1"), 1); assertEquals(TopicName.getPartitionIndex("mytopic-partition-00"), 0); assertEquals(TopicName.getPartitionIndex("mytopic-partition-012"), 12); ``` this testcase added with apache@dd8be83#diff-445b0cfa56ca0c784df78e73d9294f2a37f079ca3c15c345b03c09d56f81ebffR204 by @BewareMyPower
Motivation
The current maxTopicsPerNamespace check logic contains system topics, but it should be excluded. As the even if we turn off
allowAutoTopicCreation
, the systemtopic will auto creation too.Modifications
__transaction_buffer_snapshot
、start with the__transaction_buffer_snapshot
end with the__transaction_pending_ack
.In addition, why is mytopic-partition--1 is a partitioned topic(with --)? Which version of us uses this logic?
this testcase added with dd8be83#diff-445b0cfa56ca0c784df78e73d9294f2a37f079ca3c15c345b03c09d56f81ebffR204 by @BewareMyPower