eolivelli commented on a change in pull request #12983:
URL: https://github.com/apache/pulsar/pull/12983#discussion_r759020499



##########
File path: 
pulsar-broker/src/main/java/org/apache/pulsar/broker/admin/impl/PersistentTopicsBase.java
##########
@@ -4237,6 +4237,17 @@ protected void internalGetLastMessageId(AsyncResponse 
asyncResponse, boolean aut
             });
     }
 
+    protected CompletableFuture<Void> internalRemoveSubscriptionTypesEnabled() 
{
+        return getTopicPoliciesAsyncWithRetry(topicName)
+                .thenCompose(op -> {
+                    if (!op.isPresent()) {
+                        return CompletableFuture.completedFuture(null);
+                    }
+                    op.get().setSubscriptionTypesEnabled(Lists.newArrayList());

Review comment:
       you are using the returned object from `getTopicPoliciesAsyncWithRetry` 
using `op.get()`
   if `pulsar().getTopicPoliciesService().updateTopicPoliciesAsync` fails then 
the local copy of the variable in memory is update but the value is not write 
to persistent metadata storage.
   
   We should copy/clone the object and not mutate it.
   It would be better to have "immutable" objects, but that would be another 
story
   




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

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to