-
Notifications
You must be signed in to change notification settings - Fork 3.5k
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
Support configuring DeleteInactiveTopic setting in namespace policy #7598
Conversation
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.
@315157973 We should support settings in pulsar-admin namespaces
not in the broker.conf. If the policy is set at the namespace level, we should apply the namespace level settings. Otherwise, use the broker level settings.
pulsar-broker/src/test/resources/configurations/pulsar_broker_test.conf
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.
The changes look good and I think there are some situation needs to be clarified:
- If users do not specify the namespace level policy, use broker level config as default.
- Users can clear the namespace level policy, after that, we should use broker level configurations, So recommend adding
clear-inactive-topic-policy
here. - If the namespace level policy specified, after the broker restart, we should apply the namespace level policy.
pulsar-broker/src/main/java/org/apache/pulsar/broker/service/AbstractTopic.java
Show resolved
Hide resolved
pulsar-client-tools/src/main/java/org/apache/pulsar/admin/cli/CmdNamespaces.java
Outdated
Show resolved
Hide resolved
pulsar-client-tools/src/main/java/org/apache/pulsar/admin/cli/CmdNamespaces.java
Outdated
Show resolved
Hide resolved
pulsar-client-tools/src/main/java/org/apache/pulsar/admin/cli/CmdNamespaces.java
Outdated
Show resolved
Hide resolved
pulsar-client-tools/src/main/java/org/apache/pulsar/admin/cli/CmdNamespaces.java
Outdated
Show resolved
Hide resolved
pulsar-broker/src/main/java/org/apache/pulsar/broker/admin/v2/Namespaces.java
Outdated
Show resolved
Hide resolved
pulsar-broker/src/main/java/org/apache/pulsar/broker/admin/v2/Namespaces.java
Outdated
Show resolved
Hide resolved
...-broker/src/main/java/org/apache/pulsar/broker/service/nonpersistent/NonPersistentTopic.java
Outdated
Show resolved
Hide resolved
pulsar-broker/src/main/java/org/apache/pulsar/broker/service/persistent/PersistentTopic.java
Outdated
Show resolved
Hide resolved
pulsar-common/src/main/java/org/apache/pulsar/common/policies/data/InactiveTopicPolicies.java
Outdated
Show resolved
Hide resolved
/pulsarbot run-failure-checks |
I think this should be part of the same structure that is already used for topic auto-creation, since auto-creation and auto-deletion are tightly related |
@merlimat Do you mean we should change |
Sorry @merlimat I merged into this pull request by mistake. If necessary, can we revert this change or open a new issue to fix the corresponding problem? |
…7598) ### Motivation Support configuring DeleteInactiveTopic setting in namespace policy ### Modifications Only the two parameters `brokerDeleteInactiveTopicsMode` and `brokerDeleteInactiveTopicsMaxInactiveDurationSeconds` support namespace policy. The parameters are changed to Map structure, the key is the namespace, and the value is the parameter value. Such as: namespace1=delete_when_no_subscriptions, namespace2=delete_when_no_subscriptions. In addition, there is a key name called `default`. If it is set, other namespaces that do not specify parameters will use this parameter. Such as: default=delete_when_no_subscriptions (cherry picked from commit 00e3089)
…pache#7598) ### Motivation Support configuring DeleteInactiveTopic setting in namespace policy ### Modifications Only the two parameters `brokerDeleteInactiveTopicsMode` and `brokerDeleteInactiveTopicsMaxInactiveDurationSeconds` support namespace policy. The parameters are changed to Map structure, the key is the namespace, and the value is the parameter value. Such as: namespace1=delete_when_no_subscriptions, namespace2=delete_when_no_subscriptions. In addition, there is a key name called `default`. If it is set, other namespaces that do not specify parameters will use this parameter. Such as: default=delete_when_no_subscriptions
…pache#7598) ### Motivation Support configuring DeleteInactiveTopic setting in namespace policy ### Modifications Only the two parameters `brokerDeleteInactiveTopicsMode` and `brokerDeleteInactiveTopicsMaxInactiveDurationSeconds` support namespace policy. The parameters are changed to Map structure, the key is the namespace, and the value is the parameter value. Such as: namespace1=delete_when_no_subscriptions, namespace2=delete_when_no_subscriptions. In addition, there is a key name called `default`. If it is set, other namespaces that do not specify parameters will use this parameter. Such as: default=delete_when_no_subscriptions
…pache#7598) ### Motivation Support configuring DeleteInactiveTopic setting in namespace policy ### Modifications Only the two parameters `brokerDeleteInactiveTopicsMode` and `brokerDeleteInactiveTopicsMaxInactiveDurationSeconds` support namespace policy. The parameters are changed to Map structure, the key is the namespace, and the value is the parameter value. Such as: namespace1=delete_when_no_subscriptions, namespace2=delete_when_no_subscriptions. In addition, there is a key name called `default`. If it is set, other namespaces that do not specify parameters will use this parameter. Such as: default=delete_when_no_subscriptions
Fixes #7485
Motivation
Support configuring DeleteInactiveTopic setting in namespace policy
Modifications
Only the two parameters
brokerDeleteInactiveTopicsMode
andbrokerDeleteInactiveTopicsMaxInactiveDurationSeconds
support namespace policy. The parameters are changed to Map structure, the key is the namespace, and the value is the parameter value.Such as: namespace1=delete_when_no_subscriptions, namespace2=delete_when_no_subscriptions.
In addition, there is a key name called
default
. If it is set, other namespaces that do not specify parameters will use this parameter.Such as: default=delete_when_no_subscriptions
Verifying this change
InactiveTopicDeleteTest.java
(Please pick either of the following options)
This change is a trivial rework / code cleanup without any test coverage.
(or)
This change is already covered by existing tests, such as (please describe tests).
(or)
This change added tests and can be verified as follows:
(example:)
Does this pull request potentially affect one of the following parts:
If
yes
was chosen, please highlight the changesDocumentation