You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by "poorbarcode (via GitHub)" <gi...@apache.org> on 2023/09/27 10:27:58 UTC
[GitHub] [pulsar] poorbarcode commented on a diff in pull request #21212: [fix][broker] fix the global topic policy config override the local topic policy config
poorbarcode commented on code in PR #21212:
URL: https://github.com/apache/pulsar/pull/21212#discussion_r1338400451
##########
pulsar-broker/src/main/java/org/apache/pulsar/broker/service/persistent/PersistentTopic.java:
##########
@@ -3565,10 +3566,11 @@ private CompletableFuture<Void> updateSubscriptionsDispatcherRateLimiter() {
protected CompletableFuture<Void> initTopicPolicy() {
if (brokerService.pulsar().getConfig().isSystemTopicEnabled()
&& brokerService.pulsar().getConfig().isTopicLevelPoliciesEnabled()) {
- return CompletableFuture.completedFuture(null).thenRunAsync(() -> onUpdate(
- brokerService.getPulsar().getTopicPoliciesService()
- .getTopicPoliciesIfExists(TopicName.getPartitionedTopicName(topic))),
- brokerService.getTopicOrderedExecutor());
+ return CompletableFuture.completedFuture(null).thenRunAsync(() -> {
+ TopicPoliciesService topicPoliciesService = brokerService.getPulsar().getTopicPoliciesService();
+ onUpdate(topicPoliciesService.getLocalTopicPoliciesIfExists(TopicName.getPartitionedTopicName(topic)));
+ onUpdate(topicPoliciesService.getGlobalTopicPoliciesIfExists(TopicName.getPartitionedTopicName(topic)));
Review Comment:
This change fixed the bug that the global policies were discarded when loading a topic up. We also need to add a test to cover this fix. The test flow should be like this:
- create a topic and unload it
- set global policies
- start a consumer/producer to load the topic up
- ensure the global policies affect the topic
--
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