lhotari commented on a change in pull request #9832:
URL: https://github.com/apache/pulsar/pull/9832#discussion_r589192556
##########
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:
@codelipenghui @315157973 This introduces more thread safety issues,
similar to what is reported in #9711 . That's the reason why I think it's
better to address the thread safety issues before introducing more problems.
----------------------------------------------------------------
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]