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 2021/09/06 13:08:22 UTC

[GitHub] [pulsar] codelipenghui commented on a change in pull request #11928: Fix messages in TopicPolicies will never be cleaned up

codelipenghui commented on a change in pull request #11928:
URL: https://github.com/apache/pulsar/pull/11928#discussion_r702888599



##########
File path: pulsar-broker/src/main/java/org/apache/pulsar/broker/service/SystemTopicBasedTopicPoliciesService.java
##########
@@ -331,7 +343,14 @@ private void refreshTopicPoliciesCache(Message<PulsarEvent> msg) {
                     policiesCache.put(topicName, event.getPolicies());
                     break;
                 case DELETE:
+                    // Since PR #11928, this branch is no longer needed.
+                    // However, due to compatibility, it is temporarily retained here
+                    // and can be deleted in the future.
                     policiesCache.remove(topicName);
+                    SystemTopicClient<PulsarEvent> systemTopicClient = namespaceEventsSystemTopicFactory
+                            .createTopicPoliciesSystemTopicClient(topicName.getNamespaceObject());
+                    systemTopicClient.newWriterAsync().thenAccept(writer
+                            -> writer.deleteAsync(getPulsarEvent(topicName, ActionType.DELETE, null)));

Review comment:
       The writer should be closed and for replay the historical policies, we should use one writer instead create writer for each policy data?




-- 
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: commits-unsubscribe@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org