Skip to content
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

[improve][broker] Add additional configuration items to control the type of auto-creation of retry-topic and DLQ-topic #23806

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
[improve][broker]Optimization only automatically creates non-partitio…
…ned retry-topic and DLQ-topic
zjxxzjwang committed Jan 3, 2025
commit bc13148f452b1faebeeca1d2f703b30590a207d2
3 changes: 3 additions & 0 deletions conf/broker.conf
Original file line number Diff line number Diff line change
@@ -198,6 +198,9 @@ allowAutoTopicCreation=true
# The type of topic that is allowed to be automatically created.(partitioned/non-partitioned)
allowAutoTopicCreationType=non-partitioned

# The type of retry-topic or DLQ-topic that is allowed to be automatically created.(partitioned/non-partitioned)
allowAutoRetryOrDLQTopicCreationType=non-partitioned

# If 'allowAutoTopicCreation' is true and the name of the topic contains 'cluster',
# the topic cannot be automatically created.
allowAutoTopicCreationWithLegacyNamingScheme=true
3 changes: 3 additions & 0 deletions conf/standalone.conf
Original file line number Diff line number Diff line change
@@ -1181,6 +1181,9 @@ allowAutoTopicCreation=true
# The type of topic that is allowed to be automatically created.(partitioned/non-partitioned)
allowAutoTopicCreationType=non-partitioned

# The type of retry-topic or DLQ-topic that is allowed to be automatically created.(partitioned/non-partitioned)
allowAutoRetryOrDLQTopicCreationType=non-partitioned

# If 'allowAutoTopicCreation' is true and the name of the topic contains 'cluster',
# the topic cannot be automatically created.
allowAutoTopicCreationWithLegacyNamingScheme=true
Original file line number Diff line number Diff line change
@@ -2154,6 +2154,13 @@ The max allowed delay for delayed delivery (in milliseconds). If the broker rece
doc = "The type of topic that is allowed to be automatically created.(partitioned/non-partitioned)"
)
private TopicType allowAutoTopicCreationType = TopicType.NON_PARTITIONED;
@FieldContext(
category = CATEGORY_STORAGE_ML,
dynamic = true,
doc = "The type of retry-topic or DLQ-topic "
+ "that is allowed to be automatically created.(partitioned/non-partitioned)"
)
private TopicType allowAutoRetryOrDLQTopicCreationType = TopicType.NON_PARTITIONED;
@FieldContext(category = CATEGORY_SERVER, dynamic = true,
doc = "If 'allowAutoTopicCreation' is true and the name of the topic contains 'cluster',"
+ "the topic cannot be automatically created."
Original file line number Diff line number Diff line change
@@ -3563,8 +3563,9 @@ private CompletableFuture<Boolean> isAllowAutoTopicCreationAsync(final TopicName
}

public boolean isDefaultTopicTypePartitioned(final TopicName topicName, final Optional<Policies> policies) {
if (topicName.getPartitionedTopicName().endsWith(DLQ_GROUP_TOPIC_SUFFIX)
|| topicName.getPartitionedTopicName().endsWith(RETRY_GROUP_TOPIC_SUFFIX)) {
if (TopicType.NON_PARTITIONED.equals(pulsar.getConfiguration().getAllowAutoRetryOrDLQTopicCreationType())
&& (topicName.getPartitionedTopicName().endsWith(DLQ_GROUP_TOPIC_SUFFIX)
|| topicName.getPartitionedTopicName().endsWith(RETRY_GROUP_TOPIC_SUFFIX))) {
return false;
}
AutoTopicCreationOverride autoTopicCreationOverride = getAutoTopicCreationOverride(topicName, policies);