315157973 commented on a change in pull request #9832:
URL: https://github.com/apache/pulsar/pull/9832#discussion_r589233490
##########
File path:
pulsar-broker/src/main/java/org/apache/pulsar/broker/admin/impl/NamespacesBase.java
##########
@@ -1256,16 +1256,27 @@ protected void internalSetSubscribeRate(SubscribeRate
subscribeRate) {
}
}
+ protected void internalDeleteSubscribeRate() {
+ validateSuperUserAccess();
+ try {
+ final String path = path(POLICIES, namespaceName.toString());
+ updatePolicies(path, (policies) -> {
+
policies.clusterSubscribeRate.remove(pulsar().getConfiguration().getClusterName());
+ return policies;
+ });
+ log.info("[{}] Successfully delete the subscribeRate for cluster
on namespace {}", clientAppId(),
+ namespaceName);
+ } catch (Exception e) {
+ log.error("[{}] Failed to delete the subscribeRate for cluster on
namespace {}", clientAppId(),
+ namespaceName, e);
+ throw new RestException(e);
+ }
+ }
+
protected SubscribeRate internalGetSubscribeRate() {
validateNamespacePolicyOperation(namespaceName, PolicyName.RATE,
PolicyOperation.READ);
Policies policies = getNamespacePolicies(namespaceName);
- SubscribeRate subscribeRate =
policies.clusterSubscribeRate.get(pulsar().getConfiguration().getClusterName());
- if (subscribeRate != null) {
- return subscribeRate;
- } else {
- throw new RestException(Status.NOT_FOUND,
- "Subscribe-rate is not configured for cluster " +
pulsar().getConfiguration().getClusterName());
- }
+ return
policies.clusterSubscribeRate.get(pulsar().getConfiguration().getClusterName());
Review comment:
Thread safety issues will be revised uniformly, including this PR
----------------------------------------------------------------
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:
[email protected]