This is an automated email from the ASF dual-hosted git repository.

technoboy pushed a commit to branch branch-2.10
in repository https://gitbox.apache.org/repos/asf/pulsar.git


The following commit(s) were added to refs/heads/branch-2.10 by this push:
     new 6f99fbb5a8a [fix][broker] fix the wrong value of 
BrokerSrevice.maxUnackedMsgsPerDispatcher (#21765)
6f99fbb5a8a is described below

commit 6f99fbb5a8a94fc523802a7236dc1029221185a1
Author: AloysZhang <[email protected]>
AuthorDate: Fri Jan 5 12:18:45 2024 +0800

    [fix][broker] fix the wrong value of 
BrokerSrevice.maxUnackedMsgsPerDispatcher (#21765)
---
 .../main/java/org/apache/pulsar/broker/service/BrokerService.java | 4 ++--
 .../org/apache/pulsar/client/api/DispatcherBlockConsumerTest.java | 8 ++++----
 2 files changed, 6 insertions(+), 6 deletions(-)

diff --git 
a/pulsar-broker/src/main/java/org/apache/pulsar/broker/service/BrokerService.java
 
b/pulsar-broker/src/main/java/org/apache/pulsar/broker/service/BrokerService.java
index 6860ab57a68..b07a090b1d2 100644
--- 
a/pulsar-broker/src/main/java/org/apache/pulsar/broker/service/BrokerService.java
+++ 
b/pulsar-broker/src/main/java/org/apache/pulsar/broker/service/BrokerService.java
@@ -359,8 +359,8 @@ public class BrokerService implements Closeable {
         if (pulsar.getConfiguration().getMaxUnackedMessagesPerBroker() > 0
                 && 
pulsar.getConfiguration().getMaxUnackedMessagesPerSubscriptionOnBrokerBlocked() 
> 0.0) {
             this.maxUnackedMessages = 
pulsar.getConfiguration().getMaxUnackedMessagesPerBroker();
-            this.maxUnackedMsgsPerDispatcher = (int) ((maxUnackedMessages
-                    * 
pulsar.getConfiguration().getMaxUnackedMessagesPerSubscriptionOnBrokerBlocked())
 / 100);
+            this.maxUnackedMsgsPerDispatcher = (int) (maxUnackedMessages
+                    * 
pulsar.getConfiguration().getMaxUnackedMessagesPerSubscriptionOnBrokerBlocked());
             log.info("Enabling per-broker unack-message limit {} and 
dispatcher-limit {} on blocked-broker",
                     maxUnackedMessages, maxUnackedMsgsPerDispatcher);
             // block misbehaving dispatcher by checking periodically
diff --git 
a/pulsar-broker/src/test/java/org/apache/pulsar/client/api/DispatcherBlockConsumerTest.java
 
b/pulsar-broker/src/test/java/org/apache/pulsar/client/api/DispatcherBlockConsumerTest.java
index 1a56d689799..d69fe2557b7 100644
--- 
a/pulsar-broker/src/test/java/org/apache/pulsar/client/api/DispatcherBlockConsumerTest.java
+++ 
b/pulsar-broker/src/test/java/org/apache/pulsar/client/api/DispatcherBlockConsumerTest.java
@@ -689,8 +689,8 @@ public class DispatcherBlockConsumerTest extends 
ProducerConsumerBase {
         try {
             final int waitMills = 500;
             final int maxUnAckPerBroker = 200;
-            final double unAckMsgPercentagePerDispatcher = 10;
-            int maxUnAckPerDispatcher = (int) ((maxUnAckPerBroker * 
unAckMsgPercentagePerDispatcher) / 100); // 200 *
+            final double unAckMsgPercentagePerDispatcher = 0.1;
+            int maxUnAckPerDispatcher = (int) (maxUnAckPerBroker * 
unAckMsgPercentagePerDispatcher); // 200 *
                                                                                
                              // 10% = 20
                                                                                
                              // messages
             
pulsar.getConfiguration().setMaxUnackedMessagesPerBroker(maxUnAckPerBroker);
@@ -904,8 +904,8 @@ public class DispatcherBlockConsumerTest extends 
ProducerConsumerBase {
                 .getMaxUnackedMessagesPerSubscriptionOnBrokerBlocked();
         try {
             final int maxUnAckPerBroker = 200;
-            final double unAckMsgPercentagePerDispatcher = 10;
-            int maxUnAckPerDispatcher = (int) ((maxUnAckPerBroker * 
unAckMsgPercentagePerDispatcher) / 100); // 200 *
+            final double unAckMsgPercentagePerDispatcher = 0.1;
+            int maxUnAckPerDispatcher = (int) (maxUnAckPerBroker * 
unAckMsgPercentagePerDispatcher); // 200 *
                                                                                
                              // 10% = 20
                                                                                
                              // messages
             
pulsar.getConfiguration().setMaxUnackedMessagesPerBroker(maxUnAckPerBroker);

Reply via email to