You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by pe...@apache.org on 2024/01/05 04:18:51 UTC
(pulsar) branch master updated: [fix][broker] fix the wrong value of BrokerSrevice.maxUnackedMsgsPerDispatcher (#21765)
This is an automated email from the ASF dual-hosted git repository.
penghui pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/pulsar.git
The following commit(s) were added to refs/heads/master by this push:
new 67eb3c463a5 [fix][broker] fix the wrong value of BrokerSrevice.maxUnackedMsgsPerDispatcher (#21765)
67eb3c463a5 is described below
commit 67eb3c463a535941e1f7996d827dab294925c018
Author: AloysZhang <lo...@gmail.com>
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 fae81c1f644..ae7744fef7c 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
@@ -375,8 +375,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 fc103a46027..bd0119823fd 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
@@ -692,8 +692,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);
@@ -907,8 +907,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);