jianyun8023 commented on a change in pull request #7646:
URL: https://github.com/apache/pulsar/pull/7646#discussion_r459519372
##########
File path:
pulsar-broker/src/main/java/org/apache/pulsar/broker/admin/impl/PersistentTopicsBase.java
##########
@@ -2000,6 +2004,94 @@ protected PersistentOfflineTopicStats
internalGetBacklog(boolean authoritative)
return offlineTopicStats;
}
+ protected void internalSetBacklogQuota(AsyncResponse asyncResponse,
BacklogQuota.BacklogQuotaType backlogQuotaType, BacklogQuota backlogQuota) {
+ validateAdminAccessForTenant(namespaceName.getTenant());
+ validatePoliciesReadOnlyAccess();
+ if (topicName.isGlobal()) {
+ validateGlobalNamespaceOwnership(namespaceName);
+ }
+ if (backlogQuotaType == null) {
+ backlogQuotaType =
BacklogQuota.BacklogQuotaType.destination_storage;
+ }
+ checkTopicLevelPolicyEnable();
+ TopicPolicies topicPolicies;
+ try {
+ topicPolicies =
pulsar().getTopicPoliciesService().getTopicPolicies(topicName);
+ } catch (BrokerServiceException.TopicPoliciesCacheNotInitException e) {
+ log.warn("Topic {} policies cache have not init.", topicName);
+ asyncResponse.resume(new RestException(e));
+ return;
+ }
+ if (topicPolicies == null){
+ topicPolicies = new TopicPolicies();
+ }
+
+ RetentionPolicies retentionPolicies = getRetentionPolicies(topicName,
topicPolicies);
+ if(!checkQuotas(backlogQuota,retentionPolicies)){
+ log.warn(
+ "[{}] Failed to update backlog configuration for topic {}:
conflicts with retention quota",
+ clientAppId(), topicName);
+ throw new RestException(Status.PRECONDITION_FAILED,
+ "Backlog Quota exceeds configured retention quota for
topic. Please increase retention quota and retry");
+ }
+
+ if(backlogQuota!=null){
Review comment:
I have modified
----------------------------------------------------------------
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]