abhilashmandaliya commented on a change in pull request #11671:
URL: https://github.com/apache/pulsar/pull/11671#discussion_r690920856



##########
File path: 
pulsar-broker/src/main/java/org/apache/pulsar/broker/service/BacklogQuotaManager.java
##########
@@ -53,9 +53,10 @@
 
     public BacklogQuotaManager(PulsarService pulsar) {
         this.isTopicLevelPoliciesEnable = 
pulsar.getConfiguration().isTopicLevelPoliciesEnabled();
+        double backlogQuotaGB = 
pulsar.getConfiguration().getBacklogQuotaDefaultLimitGB();
         this.defaultQuota = BacklogQuotaImpl.builder()
-                
.limitSize(pulsar.getConfiguration().getBacklogQuotaDefaultLimitGB()
-                        * BacklogQuotaImpl.BYTES_IN_GIGABYTE)
+                .limitSize(backlogQuotaGB > 0 ? (long) backlogQuotaGB * 
BacklogQuotaImpl.BYTES_IN_GIGABYTE

Review comment:
       @rdhabalia / @eolivelli  shouldn't this be `(long) (backlogQuotaGB * 
BacklogQuotaImpl.BYTES_IN_GIGABYTE)`? Because here the double value of 
user-configured backlog in GB is converted to long before converting to bytes 
which keeps the same behaviour as before. Aren't we losing the purpose of using 
double here? Or I am misunderstood? 
   
   e.g:
   ```
   public class HelloWorld {
       public static void main(String[] args) {
           double a = 1.6;
           System.out.println((long) a * 1024); // 1024, unexpected
           System.out.println((long) (a * 1024)); // 1638, expected
       }
   }
   ```




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