aloyszhang commented on code in PR #21765:
URL: https://github.com/apache/pulsar/pull/21765#discussion_r1433438366


##########
pulsar-broker/src/main/java/org/apache/pulsar/broker/service/BrokerService.java:
##########
@@ -373,10 +373,10 @@ public BrokerService(PulsarService pulsar, EventLoopGroup 
eventLoopGroup) throws
         this.topicLoadRequestSemaphore = new AtomicReference<Semaphore>(
                 new 
Semaphore(pulsar.getConfiguration().getMaxConcurrentTopicLoadRequest(), false));
         if (pulsar.getConfiguration().getMaxUnackedMessagesPerBroker() > 0
-                && 
pulsar.getConfiguration().getMaxUnackedMessagesPerSubscriptionOnBrokerBlocked() 
> 0.0) {
+                && 
pulsar.getConfiguration().getMaxUnackedMessagesPerSubscriptionOnBrokerBlocked() 
> 0) {
             this.maxUnackedMessages = 
pulsar.getConfiguration().getMaxUnackedMessagesPerBroker();
-            this.maxUnackedMsgsPerDispatcher = (int) ((maxUnackedMessages
-                    * 
pulsar.getConfiguration().getMaxUnackedMessagesPerSubscriptionOnBrokerBlocked())
 / 100);
+            this.maxUnackedMsgsPerDispatcher = maxUnackedMessages
+                    * 
pulsar.getConfiguration().getMaxUnackedMessagesPerSubscriptionOnBrokerBlocked() 
/ 100;

Review Comment:
   Both of these two ways make sense.
   
   As I  describe in the motivation, the Javadoc and the UT take this 
configuration as a percentage which is type int.
   
   > But could we simplify by just not dividing 100?
   
   We also need to change the UT parameters for  DispatcherBlockConsumerTest 
like
   ```java
   final double unAckMsgPercentagePerDispatcher = 10;
   ```
   to
   ```java
   final double unAckMsgPercentagePerDispatcher = 0.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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to