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/08/14 03:43:36 UTC

[GitHub] [pulsar] rdhabalia opened a new pull request #11671: [server] Allow broker to start with default backlogquota in bytes

rdhabalia opened a new pull request #11671:
URL: https://github.com/apache/pulsar/pull/11671


   ### Motivation 
   It addresses: #11647
   
   ### Modification
   introduce default backlogQuotaLimit config with smallest supported dimension `byte`. and deprecated config with GB. It also allows user to configure double value for GB to configure backlog in bytes using double value of `backlogQuotaDefaultLimitGB`


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



[GitHub] [pulsar] abhilashmandaliya commented on a change in pull request #11671: [server] Allow broker to start with default backlogquota in bytes

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

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



[GitHub] [pulsar] rdhabalia commented on a change in pull request #11671: [server] Allow broker to start with default backlogquota in bytes

Posted by GitBox <gi...@apache.org>.
rdhabalia commented on a change in pull request #11671:
URL: https://github.com/apache/pulsar/pull/11671#discussion_r689722778



##########
File path: pulsar-broker/src/test/java/org/apache/pulsar/broker/service/BacklogQuotaManagerTest.java
##########
@@ -1211,5 +1218,45 @@ public void testProducerExceptionAndThenUnblockTimeQuota() throws Exception {
         client.close();
     }
 
+    @Test(dataProvider = "backlogQuotaSizeGB")
+    public void testBacklogQuotaInGB(boolean backlogQuotaSizeGB) throws Exception {
+
+        pulsar.close();
+        long backlogQuotaByte = 10 * 1024;
+        if (backlogQuotaSizeGB) {
+            config.setBacklogQuotaDefaultLimitGB(((double) backlogQuotaByte) / BacklogQuotaImpl.BYTES_IN_GIGABYTE);
+        } else {
+            config.setBacklogQuotaDefaultLimitByte(backlogQuotaByte);
+        }
+        config.setBacklogQuotaDefaultRetentionPolicy(BacklogQuota.RetentionPolicy.consumer_backlog_eviction);
+        pulsar = new PulsarService(config);
+        pulsar.start();
+
+        @Cleanup
+        PulsarClient client = PulsarClient.builder().serviceUrl(pulsar.getBrokerServiceUrl()).statsInterval(0, TimeUnit.SECONDS)
+                .build();
+
+        final String topic1 = "persistent://prop/ns-quota/topic2";
+        final String subName1 = "c1";
+        final String subName2 = "c2";
+        final int numMsgs = 20;
+
+        Consumer<byte[]> consumer1 = client.newConsumer().topic(topic1).subscriptionName(subName1).subscribe();
+        Consumer<byte[]> consumer2 = client.newConsumer().topic(topic1).subscriptionName(subName2).subscribe();
+        org.apache.pulsar.client.api.Producer<byte[]> producer = createProducer(client, topic1);
+        byte[] content = new byte[1024];
+        for (int i = 0; i < numMsgs; i++) {
+            producer.send(content);
+            consumer1.receive();
+            consumer2.receive();
+        }
+
+        Thread.sleep((TIME_TO_CHECK_BACKLOG_QUOTA + 1) * 1000);
+        rolloverStats();
+
+        TopicStats stats = admin.topics().getStats(topic1);
+        assertTrue(stats.getBacklogSize() < 10 * 1024, "Storage size is [" + stats.getStorageSize() + "]");
+        System.out.println("finish");

Review comment:
       oops. I missed removing it after the testing.




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



[GitHub] [pulsar] eolivelli commented on a change in pull request #11671: [server] Allow broker to start with default backlogquota in bytes

Posted by GitBox <gi...@apache.org>.
eolivelli commented on a change in pull request #11671:
URL: https://github.com/apache/pulsar/pull/11671#discussion_r688929927



##########
File path: pulsar-broker/src/test/java/org/apache/pulsar/broker/service/BacklogQuotaManagerTest.java
##########
@@ -1211,5 +1218,45 @@ public void testProducerExceptionAndThenUnblockTimeQuota() throws Exception {
         client.close();
     }
 
+    @Test(dataProvider = "backlogQuotaSizeGB")
+    public void testBacklogQuotaInGB(boolean backlogQuotaSizeGB) throws Exception {
+
+        pulsar.close();
+        long backlogQuotaByte = 10 * 1024;
+        if (backlogQuotaSizeGB) {
+            config.setBacklogQuotaDefaultLimitGB(((double) backlogQuotaByte) / BacklogQuotaImpl.BYTES_IN_GIGABYTE);
+        } else {
+            config.setBacklogQuotaDefaultLimitByte(backlogQuotaByte);
+        }
+        config.setBacklogQuotaDefaultRetentionPolicy(BacklogQuota.RetentionPolicy.consumer_backlog_eviction);
+        pulsar = new PulsarService(config);
+        pulsar.start();
+
+        @Cleanup
+        PulsarClient client = PulsarClient.builder().serviceUrl(pulsar.getBrokerServiceUrl()).statsInterval(0, TimeUnit.SECONDS)
+                .build();
+
+        final String topic1 = "persistent://prop/ns-quota/topic2";
+        final String subName1 = "c1";
+        final String subName2 = "c2";
+        final int numMsgs = 20;
+
+        Consumer<byte[]> consumer1 = client.newConsumer().topic(topic1).subscriptionName(subName1).subscribe();
+        Consumer<byte[]> consumer2 = client.newConsumer().topic(topic1).subscriptionName(subName2).subscribe();
+        org.apache.pulsar.client.api.Producer<byte[]> producer = createProducer(client, topic1);
+        byte[] content = new byte[1024];
+        for (int i = 0; i < numMsgs; i++) {
+            producer.send(content);
+            consumer1.receive();
+            consumer2.receive();
+        }
+
+        Thread.sleep((TIME_TO_CHECK_BACKLOG_QUOTA + 1) * 1000);
+        rolloverStats();
+
+        TopicStats stats = admin.topics().getStats(topic1);
+        assertTrue(stats.getBacklogSize() < 10 * 1024, "Storage size is [" + stats.getStorageSize() + "]");
+        System.out.println("finish");

Review comment:
       Nit: user logger or drop this line

##########
File path: pulsar-broker-common/src/main/java/org/apache/pulsar/broker/ServiceConfiguration.java
##########
@@ -334,12 +334,19 @@
     )
     private int backlogQuotaCheckIntervalInSeconds = 60;
 
+    @Deprecated
+    @FieldContext(
+        category = CATEGORY_POLICIES,
+        doc = "@deprecated - Use backlogQuotaDefaultLimitByte instead.\""
+    )
+    private double backlogQuotaDefaultLimitGB = -1;
+
     @FieldContext(
         category = CATEGORY_POLICIES,
         doc = "Default per-topic backlog quota limit by size, less than 0 means no limitation. default is -1."
                 + " Increase it if you want to allow larger msg backlog"
     )
-    private long backlogQuotaDefaultLimitGB = -1;
+    private long backlogQuotaDefaultLimitByte = -1;
 

Review comment:
       What about using plural form for the unit?
   backlogQuotaDefaultLimitBytes 




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



[GitHub] [pulsar] abhilashmandaliya commented on a change in pull request #11671: [server] Allow broker to start with default backlogquota in bytes

Posted by GitBox <gi...@apache.org>.
abhilashmandaliya commented on a change in pull request #11671:
URL: https://github.com/apache/pulsar/pull/11671#discussion_r690976781



##########
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:
       here it is: https://github.com/apache/pulsar/pull/11697




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



[GitHub] [pulsar] abhilashmandaliya commented on a change in pull request #11671: [server] Allow broker to start with default backlogquota in bytes

Posted by GitBox <gi...@apache.org>.
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
       }
   }
   ```
   
   Edit:
   I can see that what I mentioned above has been done in `ConfigHelper.java` which looks correct.




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



[GitHub] [pulsar] Anonymitaet commented on a change in pull request #11671: [server] Allow broker to start with default backlogquota in bytes

Posted by GitBox <gi...@apache.org>.
Anonymitaet commented on a change in pull request #11671:
URL: https://github.com/apache/pulsar/pull/11671#discussion_r689174175



##########
File path: site2/docs/reference-configuration.md
##########
@@ -175,7 +175,7 @@ Pulsar brokers are responsible for handling incoming messages from producers, di
 |skipBrokerShutdownOnOOM| Flag to skip broker shutdown when broker handles Out of memory error. |false|
 |backlogQuotaCheckEnabled|  Enable backlog quota check. Enforces action on topic when the quota is reached  |true|
 |backlogQuotaCheckIntervalInSeconds|  How often to check for topics that have reached the quota |60|
-|backlogQuotaDefaultLimitGB| The default per-topic backlog quota limit. Being less than 0 means no limitation. By default, it is -1. | -1 |
+|backlogQuotaDefaultLimitByte| The default per-topic backlog quota limit. Being less than 0 means no limitation. By default, it is -1. | -1 |

Review comment:
       ```suggestion
   |backlogQuotaDefaultLimitByte| The default per-topic backlog quota limit. A value less than 0 means no limit. | -1 |
   ```




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



[GitHub] [pulsar] abhilashmandaliya commented on a change in pull request #11671: [server] Allow broker to start with default backlogquota in bytes

Posted by GitBox <gi...@apache.org>.
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
       }
   }
   ```
   
   Edit:
   The same is the case for `ConfigHelper.java`.




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



[GitHub] [pulsar] eolivelli commented on a change in pull request #11671: [server] Allow broker to start with default backlogquota in bytes

Posted by GitBox <gi...@apache.org>.
eolivelli commented on a change in pull request #11671:
URL: https://github.com/apache/pulsar/pull/11671#discussion_r690940233



##########
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:
       good catch !
   can you please send a PR to fix it ASAP ?




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



[GitHub] [pulsar] rdhabalia merged pull request #11671: [server] Allow broker to start with default backlogquota in bytes

Posted by GitBox <gi...@apache.org>.
rdhabalia merged pull request #11671:
URL: https://github.com/apache/pulsar/pull/11671


   


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



[GitHub] [pulsar] Anonymitaet commented on pull request #11671: [server] Allow broker to start with default backlogquota in bytes

Posted by GitBox <gi...@apache.org>.
Anonymitaet commented on pull request #11671:
URL: https://github.com/apache/pulsar/pull/11671#issuecomment-899143053


   @rdhabalia Thanks for your contribution. If your PR contains doc updates, please label it with `doc`, thanks.
   


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



[GitHub] [pulsar] abhilashmandaliya commented on a change in pull request #11671: [server] Allow broker to start with default backlogquota in bytes

Posted by GitBox <gi...@apache.org>.
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
       }
   }
   ```

##########
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
       }
   }
   ```
   
   Edit:
   I can see that what I mentioned above has been done in `ConfigHelper.java` which looks correct.

##########
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
       }
   }
   ```
   
   Edit:
   The same is the case for `ConfigHelper.java`.

##########
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:
       here it is: https://github.com/apache/pulsar/pull/11697




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



[GitHub] [pulsar] eolivelli commented on a change in pull request #11671: [server] Allow broker to start with default backlogquota in bytes

Posted by GitBox <gi...@apache.org>.
eolivelli commented on a change in pull request #11671:
URL: https://github.com/apache/pulsar/pull/11671#discussion_r690940233



##########
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:
       good catch !
   can you please send a PR to fix it ASAP ?




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