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 2020/11/04 14:23:27 UTC

[GitHub] [pulsar] gaoran10 commented on a change in pull request #8446: add rest api: unsetOffloadPolicies

gaoran10 commented on a change in pull request #8446:
URL: https://github.com/apache/pulsar/pull/8446#discussion_r517379437



##########
File path: pulsar-broker/src/main/java/org/apache/pulsar/broker/admin/impl/NamespacesBase.java
##########
@@ -3000,6 +3001,47 @@ protected void internalSetOffloadPolicies(AsyncResponse asyncResponse, OffloadPo
         }
     }
 
+    protected void internalRemoveOffloadPolicies(AsyncResponse asyncResponse) {
+        validateNamespacePolicyOperation(namespaceName, PolicyName.OFFLOAD, PolicyOperation.WRITE);
+        validatePoliciesReadOnlyAccess();
+
+        try {
+            Stat nodeStat = new Stat();
+            final String path = path(POLICIES, namespaceName.toString());
+            byte[] content = globalZk().getData(path, null, nodeStat);
+            Policies policies = jsonMapper().readValue(content, Policies.class);
+
+            policies.offload_policies = null;
+            String updatedOffloadPolicies = jsonMapper().writeValueAsString(policies.offload_policies);

Review comment:
       Maybe this is not necessary? The log could be just like `Successfully remove the namespace offload policies.`.




----------------------------------------------------------------
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