-
Notifications
You must be signed in to change notification settings - Fork 3.7k
Description
Search before reporting
- I searched in the issues and found nothing similar.
Read release policy
- I understand that unsupported versions don't get bug fixes. I will attempt to reproduce the issue on a supported version of Pulsar client and Pulsar broker.
User environment
Potentially all released Pulsar versions that include org.apache.pulsar.broker.resourcegroup.ResourceGroupService, since 2.8.0 . It was part of PIP-82.
Issue Description
The documentation for "resourceUsageTransportPublishIntervalInSecs" states: "Default interval to publish usage reports if resourceUsagePublishToTopic is enabled."
pulsar/pulsar-broker-common/src/main/java/org/apache/pulsar/broker/ServiceConfiguration.java
Lines 1181 to 1186 in fcd5f92
@FieldContext( | |
dynamic = true, | |
category = CATEGORY_POLICIES, | |
doc = "Default interval to publish usage reports if resourceUsagePublishToTopic is enabled." | |
) | |
private int resourceUsageTransportPublishIntervalInSecs = 60; |
However, the documentation for the configuration setting doesn't make sense since the job to iterate all topic stats happens every 60 seconds:
pulsar/pulsar-broker/src/main/java/org/apache/pulsar/broker/resourcegroup/ResourceGroupService.java
Lines 693 to 710 in fcd5f92
private void initialize() { | |
ServiceConfiguration config = this.pulsar.getConfiguration(); | |
long periodInSecs = config.getResourceUsageTransportPublishIntervalInSecs(); | |
this.aggregateLocalUsagePeriodInSeconds = this.resourceUsagePublishPeriodInSeconds = periodInSecs; | |
this.aggregateLocalUsagePeriodicTask = this.pulsar.getExecutor().scheduleAtFixedRate( | |
catchingAndLoggingThrowables(this::aggregateResourceGroupLocalUsages), | |
periodInSecs, | |
periodInSecs, | |
this.timeUnitScale); | |
this.calculateQuotaPeriodicTask = this.pulsar.getExecutor().scheduleAtFixedRate( | |
catchingAndLoggingThrowables(this::calculateQuotaForAllResourceGroups), | |
periodInSecs, | |
periodInSecs, | |
this.timeUnitScale); | |
maxIntervalForSuppressingReportsMSecs = | |
TimeUnit.SECONDS.toMillis(this.resourceUsagePublishPeriodInSeconds) * MaxUsageReportSuppressRounds; | |
} |
pulsar/pulsar-broker/src/main/java/org/apache/pulsar/broker/resourcegroup/ResourceGroupService.java
Lines 542 to 550 in fcd5f92
protected void aggregateResourceGroupLocalUsages() { | |
final Summary.Timer aggrUsageTimer = rgUsageAggregationLatency.startTimer(); | |
BrokerService bs = this.pulsar.getBrokerService(); | |
Map<String, TopicStatsImpl> topicStatsMap = bs.getTopicStats(); | |
for (Map.Entry<String, TopicStatsImpl> entry : topicStatsMap.entrySet()) { | |
final String topicName = entry.getKey(); | |
final TopicStats topicStats = entry.getValue(); | |
final TopicName topic = TopicName.get(topicName); |
It would be expected that ResourceGroupService wouldn't perform any activities unless it's used and needed.
Error messages
Reproducing the issue
See the description above.
Additional information
No response
Are you willing to submit a PR?
- I'm willing to submit a PR!