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



##########
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);
+            globalZk().setData(path, jsonMapper().writeValueAsBytes(policies), 
nodeStat.getVersion(),
+                    (rc, path1, ctx, stat) -> {
+                        if (rc == KeeperException.Code.OK.intValue()) {
+                            policiesCache().invalidate(path(POLICIES, 
namespaceName.toString()));
+                            log.info("[{}] Successfully updated offload 
configuration: namespace={}, map={}", clientAppId(),
+                                    namespaceName, updatedOffloadPolicies);
+                            asyncResponse.resume(Response.noContent().build());
+                        } else {
+                            String errorMsg = String.format(
+                                    "[%s] Failed to update offload 
configuration for namespace %s",

Review comment:
       ```suggestion
                                       "[%s] Failed to remove offload 
configuration for namespace %s",
   ```




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


Reply via email to