You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by te...@apache.org on 2024/01/05 12:58:26 UTC
(pulsar) branch branch-3.2 updated: [fix][broker] fix the wrong value of BrokerSrevice.maxUnackedMsgsPerDispatcher (#21765)
This is an automated email from the ASF dual-hosted git repository.
technoboy pushed a commit to branch branch-3.2
in repository https://gitbox.apache.org/repos/asf/pulsar.git
The following commit(s) were added to refs/heads/branch-3.2 by this push:
new 1743cbba20e [fix][broker] fix the wrong value of BrokerSrevice.maxUnackedMsgsPerDispatcher (#21765)
1743cbba20e is described below
commit 1743cbba20e9cc81d93d48893aeee411b189dae7
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 4077762bb06..8642815430a 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);