You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by GitBox <gi...@apache.org> on 2021/03/23 11:45:02 UTC
[GitHub] [pulsar] codelipenghui opened a new pull request #10015: Support set property on a namespace.
codelipenghui opened a new pull request #10015:
URL: https://github.com/apache/pulsar/pull/10015
### Motivation
Add support for set-property/get-property/remove-property on a namespace
### Modifications
bin/pulsar-admin namespaces set-property
bin/pulsar-admin namespaces get-property
bin/pulsar-admin namespaces remove-property
### Does this pull request potentially affect one of the following parts:
*If `yes` was chosen, please highlight the changes*
- Dependencies (does it add or upgrade a dependency): (no)
- The public API: (yes)
- The schema: (no)
- The default values of configurations: (no)
- The wire protocol: (no)
- The rest endpoints: (no)
- The admin cli options: (no)
- Anything that affects deployment: (no)
### Documentation
- Does this pull request introduce a new feature? (yes)
The document is generated automatically.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [pulsar] codelipenghui merged pull request #10015: Support set property on a namespace.
Posted by GitBox <gi...@apache.org>.
codelipenghui merged pull request #10015:
URL: https://github.com/apache/pulsar/pull/10015
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [pulsar] zymap commented on a change in pull request #10015: Support set property on a namespace.
Posted by GitBox <gi...@apache.org>.
zymap commented on a change in pull request #10015:
URL: https://github.com/apache/pulsar/pull/10015#discussion_r599587564
##########
File path: pulsar-broker/src/main/java/org/apache/pulsar/broker/admin/impl/NamespacesBase.java
##########
@@ -2546,6 +2546,45 @@ protected void internalSetMaxTopicsPerNamespace(Integer maxTopicsPerNamespace) {
internalSetPolicies("max_topics_per_namespace", maxTopicsPerNamespace);
}
+ protected void internalSetProperty(String key, String value) {
+ validatePoliciesReadOnlyAccess();
+ try {
+ final String path = path(POLICIES, namespaceName.toString());
+ updatePolicies(path, (policies) -> {
+ policies.properties.put(key, value);
Review comment:
Do we need to provide an option for overwriting the existing key?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [pulsar] codelipenghui commented on pull request #10015: Support set property on a namespace.
Posted by GitBox <gi...@apache.org>.
codelipenghui commented on pull request #10015:
URL: https://github.com/apache/pulsar/pull/10015#issuecomment-811100757
@sijie Make sense, will add an endpoint to support multiple key-values.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [pulsar] 315157973 commented on pull request #10015: Support set property on a namespace.
Posted by GitBox <gi...@apache.org>.
315157973 commented on pull request #10015:
URL: https://github.com/apache/pulsar/pull/10015#issuecomment-809028564
/pulsarbot run-failure-checks
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [pulsar] 315157973 commented on a change in pull request #10015: Support set property on a namespace.
Posted by GitBox <gi...@apache.org>.
315157973 commented on a change in pull request #10015:
URL: https://github.com/apache/pulsar/pull/10015#discussion_r601976413
##########
File path: pulsar-broker/src/main/java/org/apache/pulsar/broker/admin/impl/NamespacesBase.java
##########
@@ -2546,6 +2546,45 @@ protected void internalSetMaxTopicsPerNamespace(Integer maxTopicsPerNamespace) {
internalSetPolicies("max_topics_per_namespace", maxTopicsPerNamespace);
}
+ protected void internalSetProperty(String key, String value) {
+ validatePoliciesReadOnlyAccess();
+ try {
+ final String path = path(POLICIES, namespaceName.toString());
+ updatePolicies(path, (policies) -> {
+ policies.properties.put(key, value);
Review comment:
What if I want to remove this key?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [pulsar] 315157973 commented on a change in pull request #10015: Support set property on a namespace.
Posted by GitBox <gi...@apache.org>.
315157973 commented on a change in pull request #10015:
URL: https://github.com/apache/pulsar/pull/10015#discussion_r602133173
##########
File path: pulsar-broker/src/main/java/org/apache/pulsar/broker/admin/impl/NamespacesBase.java
##########
@@ -2546,6 +2546,45 @@ protected void internalSetMaxTopicsPerNamespace(Integer maxTopicsPerNamespace) {
internalSetPolicies("max_topics_per_namespace", maxTopicsPerNamespace);
}
+ protected void internalSetProperty(String key, String value) {
+ validatePoliciesReadOnlyAccess();
+ try {
+ final String path = path(POLICIES, namespaceName.toString());
+ updatePolicies(path, (policies) -> {
+ policies.properties.put(key, value);
Review comment:
Oh i see, thanks for the explanation
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [pulsar] codelipenghui commented on a change in pull request #10015: Support set property on a namespace.
Posted by GitBox <gi...@apache.org>.
codelipenghui commented on a change in pull request #10015:
URL: https://github.com/apache/pulsar/pull/10015#discussion_r600964983
##########
File path: pulsar-broker/src/main/java/org/apache/pulsar/broker/admin/impl/NamespacesBase.java
##########
@@ -2546,6 +2546,45 @@ protected void internalSetMaxTopicsPerNamespace(Integer maxTopicsPerNamespace) {
internalSetPolicies("max_topics_per_namespace", maxTopicsPerNamespace);
}
+ protected void internalSetProperty(String key, String value) {
+ validatePoliciesReadOnlyAccess();
+ try {
+ final String path = path(POLICIES, namespaceName.toString());
+ updatePolicies(path, (policies) -> {
+ policies.properties.put(key, value);
Review comment:
Overwriting the existing key is the default behavior. If we need to support prevent an update when the key exists, we can add it in the future.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [pulsar] codelipenghui commented on a change in pull request #10015: Support set property on a namespace.
Posted by GitBox <gi...@apache.org>.
codelipenghui commented on a change in pull request #10015:
URL: https://github.com/apache/pulsar/pull/10015#discussion_r602097455
##########
File path: pulsar-broker/src/main/java/org/apache/pulsar/broker/admin/impl/NamespacesBase.java
##########
@@ -2546,6 +2546,45 @@ protected void internalSetMaxTopicsPerNamespace(Integer maxTopicsPerNamespace) {
internalSetPolicies("max_topics_per_namespace", maxTopicsPerNamespace);
}
+ protected void internalSetProperty(String key, String value) {
+ validatePoliciesReadOnlyAccess();
+ try {
+ final String path = path(POLICIES, namespaceName.toString());
+ updatePolicies(path, (policies) -> {
+ policies.properties.put(key, value);
Review comment:
Do you mean here https://github.com/apache/pulsar/pull/10015/files#diff-8696b1e2ba4ee355256e31b33ccc4f1cab77f1c6c79f7b4ab508b73d43d8ad55R2576 ?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org