gaoran10 commented on a change in pull request #11821:
URL: https://github.com/apache/pulsar/pull/11821#discussion_r698208593
##########
File path:
pulsar-broker/src/main/java/org/apache/pulsar/broker/resourcegroup/ResourceGroupService.java
##########
@@ -612,10 +612,18 @@ protected void calculateQuotaForAllResourceGroups() {
BytesAndMessagesCount oldBMCount =
resourceGroup.updateLocalQuota(monClass, updatedQuota);
rgCalculatedQuotaMessages.labels(rgName,
monClass.name()).inc(updatedQuota.messages);
rgCalculatedQuotaBytes.labels(rgName,
monClass.name()).inc(updatedQuota.bytes);
- long messagesIncrement = updatedQuota.messages -
oldBMCount.messages;
- long bytesIncrement = updatedQuota.bytes -
oldBMCount.bytes;
- log.debug("calculateQuota for RG {} [class {}]: bytes
incremented by {}, messages by {}",
- rgName, monClass, messagesIncrement,
bytesIncrement);
+ if (oldBMCount != null) {
+ long messagesIncrement = updatedQuota.messages -
oldBMCount.messages;
+ long bytesIncrement = updatedQuota.bytes -
oldBMCount.bytes;
+ log.debug("calculateQuota for RG={} [class {}]:
updatedlocalBytes={}, updatedlocalMesgs={}; "
Review comment:
Please add debug enable check.
##########
File path:
pulsar-broker/src/main/java/org/apache/pulsar/broker/resourcegroup/ResourceQuotaCalculatorImpl.java
##########
@@ -39,9 +39,10 @@ public long computeLocalQuota(long confUsage, long myUsage,
long[] allUsages) th
if (confUsage < 0) {
// This can happen if the RG is not configured with this
particular limit (message or byte count) yet.
- // It is safe to return a high value (so we don't limit) for the
quota.
- log.debug("Configured usage {} is not set; returning a high
calculated quota", confUsage);
- return Long.MAX_VALUE;
+ val retVal = -1;
+ log.debug("Configured usage ({}) is not set; returning a special
value ({}) for calculated quota",
Review comment:
Please add debug enable check.
##########
File path:
pulsar-broker/src/main/java/org/apache/pulsar/broker/resourcegroup/ResourceGroup.java
##########
@@ -321,6 +321,12 @@ protected BytesAndMessagesCount
getGlobalUsageStats(ResourceGroupMonitoringClass
protected BytesAndMessagesCount
updateLocalQuota(ResourceGroupMonitoringClass monClass,
BytesAndMessagesCount
newQuota) throws PulsarAdminException {
+ // Only the Publish side is functional now; add the Dispatch side code
when the consume side is ready.
+ if (monClass != ResourceGroupMonitoringClass.Publish) {
+ log.debug("Doing nothing for monClass={}; only Publish is
functional", monClass);
Review comment:
Please add debug enable check.
##########
File path:
pulsar-broker/src/main/java/org/apache/pulsar/broker/resourcegroup/ResourceGroup.java
##########
@@ -321,6 +321,12 @@ protected BytesAndMessagesCount
getGlobalUsageStats(ResourceGroupMonitoringClass
protected BytesAndMessagesCount
updateLocalQuota(ResourceGroupMonitoringClass monClass,
BytesAndMessagesCount
newQuota) throws PulsarAdminException {
+ // Only the Publish side is functional now; add the Dispatch side code
when the consume side is ready.
+ if (monClass != ResourceGroupMonitoringClass.Publish) {
Review comment:
Please use the equals method of the
`ResourceGroupMonitoringClass.Publish`.
```
!ResourceGroupMonitoringClass.Publish.equals(monClass)
```
##########
File path:
pulsar-broker/src/main/java/org/apache/pulsar/broker/resourcegroup/ResourceGroupService.java
##########
@@ -612,10 +612,18 @@ protected void calculateQuotaForAllResourceGroups() {
BytesAndMessagesCount oldBMCount =
resourceGroup.updateLocalQuota(monClass, updatedQuota);
rgCalculatedQuotaMessages.labels(rgName,
monClass.name()).inc(updatedQuota.messages);
rgCalculatedQuotaBytes.labels(rgName,
monClass.name()).inc(updatedQuota.bytes);
- long messagesIncrement = updatedQuota.messages -
oldBMCount.messages;
- long bytesIncrement = updatedQuota.bytes -
oldBMCount.bytes;
- log.debug("calculateQuota for RG {} [class {}]: bytes
incremented by {}, messages by {}",
- rgName, monClass, messagesIncrement,
bytesIncrement);
+ if (oldBMCount != null) {
+ long messagesIncrement = updatedQuota.messages -
oldBMCount.messages;
+ long bytesIncrement = updatedQuota.bytes -
oldBMCount.bytes;
+ log.debug("calculateQuota for RG={} [class {}]:
updatedlocalBytes={}, updatedlocalMesgs={}; "
+ + "old bytes={}, old mesgs={};
incremented bytes by {}, messages by {}",
+ rgName, monClass, updatedQuota.bytes,
updatedQuota.messages,
+ oldBMCount.bytes, oldBMCount.messages,
+ bytesIncrement, messagesIncrement);
+ } else {
+ log.debug("calculateQuota for RG={} [class {}]: got
back null from updateLocalQuota",
Review comment:
Please add debug enable check.
--
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]