You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by lh...@apache.org on 2025/09/16 04:22:26 UTC
(pulsar) branch branch-4.0 updated (ec9039dc994 -> 298bba47d60)
This is an automated email from the ASF dual-hosted git repository.
lhotari pushed a change to branch branch-4.0
in repository https://gitbox.apache.org/repos/asf/pulsar.git
from ec9039dc994 [fix][ml] Negative backlog & acked positions does not exist & message lost when concurrently occupying topic owner (#24722)
new d2493990c5b [improve][build] Upgrade Apache Parent POM to version 35 (#24742)
new 298bba47d60 [fix][client] Fix receiver queue auto-scale without memory limit (#24743)
The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
Summary of changes:
build/run_unit_group.sh | 2 +-
buildtools/pom.xml | 2 +-
pom.xml | 2 +-
pulsar-bom/pom.xml | 2 +-
.../impl/AutoScaledReceiverQueueSizeTest.java | 34 ++++++++++++++++++++++
.../pulsar/client/impl/MemoryLimitController.java | 3 ++
.../client/impl/MemoryLimitControllerTest.java | 7 +++++
7 files changed, 48 insertions(+), 4 deletions(-)
(pulsar) 02/02: [fix][client] Fix receiver queue auto-scale without memory limit (#24743)
Posted by lh...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
lhotari pushed a commit to branch branch-4.0
in repository https://gitbox.apache.org/repos/asf/pulsar.git
commit 298bba47d60b73f8aac40da254727b5a9dc9a9ea
Author: Philipp Dolif <52...@users.noreply.github.com>
AuthorDate: Tue Sep 16 05:30:58 2025 +0200
[fix][client] Fix receiver queue auto-scale without memory limit (#24743)
(cherry picked from commit 8e35e34350866e150220872e1ed6a5c7009a43e2)
---
.../impl/AutoScaledReceiverQueueSizeTest.java | 34 ++++++++++++++++++++++
.../pulsar/client/impl/MemoryLimitController.java | 3 ++
.../client/impl/MemoryLimitControllerTest.java | 7 +++++
3 files changed, 44 insertions(+)
diff --git a/pulsar-broker/src/test/java/org/apache/pulsar/client/impl/AutoScaledReceiverQueueSizeTest.java b/pulsar-broker/src/test/java/org/apache/pulsar/client/impl/AutoScaledReceiverQueueSizeTest.java
index 114231b98e5..efd9e32b877 100644
--- a/pulsar-broker/src/test/java/org/apache/pulsar/client/impl/AutoScaledReceiverQueueSizeTest.java
+++ b/pulsar-broker/src/test/java/org/apache/pulsar/client/impl/AutoScaledReceiverQueueSizeTest.java
@@ -33,7 +33,9 @@ import org.apache.pulsar.client.api.BatchReceivePolicy;
import org.apache.pulsar.client.api.Consumer;
import org.apache.pulsar.client.api.MessageId;
import org.apache.pulsar.client.api.Producer;
+import org.apache.pulsar.client.api.PulsarClient;
import org.apache.pulsar.client.api.PulsarClientException;
+import org.apache.pulsar.client.api.SizeUnit;
import org.apache.pulsar.client.api.SubscriptionInitialPosition;
import org.apache.pulsar.common.util.FutureUtil;
import org.awaitility.Awaitility;
@@ -319,4 +321,36 @@ public class AutoScaledReceiverQueueSizeTest extends MockedPulsarServiceBaseTest
Assert.assertEquals(controller.currentUsage(), 0);
Assert.assertEquals(controller.currentUsagePercent(), 0);
}
+
+ @Test
+ public void testWithoutMemoryLimit() throws PulsarClientException {
+ @Cleanup
+ PulsarClient clientWithoutMemoryLimit = PulsarClient.builder()
+ .memoryLimit(0, SizeUnit.BYTES)
+ .serviceUrl(pulsar.getBrokerServiceUrl())
+ .build();
+
+ String topic = "persistent://public/default/testWithoutMemoryLimit";
+ @Cleanup
+ ConsumerImpl<byte[]> consumer = (ConsumerImpl<byte[]>) clientWithoutMemoryLimit.newConsumer()
+ .topic(topic)
+ .subscriptionName("my-sub")
+ .receiverQueueSize(3)
+ .autoScaledReceiverQueueSizeEnabled(true)
+ .subscribe();
+ Assert.assertEquals(consumer.getCurrentReceiverQueueSize(), 1);
+
+ @Cleanup
+ Producer<byte[]> producer = pulsarClient.newProducer().topic(topic).enableBatching(false).create();
+ byte[] data = "data".getBytes(StandardCharsets.UTF_8);
+
+ producer.send(data);
+ Awaitility.await().until(consumer.scaleReceiverQueueHint::get);
+ Assert.assertNotNull(consumer.receive());
+
+ // this will trigger a receiver queue size expansion
+ Assert.assertNull(consumer.receive(0, TimeUnit.MILLISECONDS));
+
+ Assert.assertEquals(consumer.getCurrentReceiverQueueSize(), 2);
+ }
}
diff --git a/pulsar-client/src/main/java/org/apache/pulsar/client/impl/MemoryLimitController.java b/pulsar-client/src/main/java/org/apache/pulsar/client/impl/MemoryLimitController.java
index d7acfd69128..4f8a6fdb06a 100644
--- a/pulsar-client/src/main/java/org/apache/pulsar/client/impl/MemoryLimitController.java
+++ b/pulsar-client/src/main/java/org/apache/pulsar/client/impl/MemoryLimitController.java
@@ -139,6 +139,9 @@ public class MemoryLimitController {
}
public double currentUsagePercent() {
+ if (!isMemoryLimited()) {
+ return 0.0;
+ }
return 1.0 * currentUsage.get() / memoryLimit;
}
diff --git a/pulsar-client/src/test/java/org/apache/pulsar/client/impl/MemoryLimitControllerTest.java b/pulsar-client/src/test/java/org/apache/pulsar/client/impl/MemoryLimitControllerTest.java
index 1aaf3f77da4..027479511dd 100644
--- a/pulsar-client/src/test/java/org/apache/pulsar/client/impl/MemoryLimitControllerTest.java
+++ b/pulsar-client/src/test/java/org/apache/pulsar/client/impl/MemoryLimitControllerTest.java
@@ -49,6 +49,7 @@ public class MemoryLimitControllerTest {
@Test
public void testLimit() throws Exception {
MemoryLimitController mlc = new MemoryLimitController(100);
+ assertTrue(mlc.isMemoryLimited());
for (int i = 0; i < 101; i++) {
mlc.reserveMemory(1);
@@ -75,6 +76,12 @@ public class MemoryLimitControllerTest {
mlc.releaseMemory(50);
assertTrue(mlc.tryReserveMemory(1));
assertEquals(mlc.currentUsagePercent(), 1.01);
+
+ MemoryLimitController mlcNoLimit = new MemoryLimitController(0);
+ assertFalse(mlcNoLimit.isMemoryLimited());
+ assertEquals(mlcNoLimit.currentUsagePercent(), 0.0);
+ assertTrue(mlcNoLimit.tryReserveMemory(1));
+ assertEquals(mlcNoLimit.currentUsagePercent(), 0.0);
}
@Test
(pulsar) 01/02: [improve][build] Upgrade Apache Parent POM to version 35 (#24742)
Posted by lh...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
lhotari pushed a commit to branch branch-4.0
in repository https://gitbox.apache.org/repos/asf/pulsar.git
commit d2493990c5b93b3fea782b8196e0ba304b10ec52
Author: Lari Hotari <lh...@users.noreply.github.com>
AuthorDate: Tue Sep 16 06:23:56 2025 +0300
[improve][build] Upgrade Apache Parent POM to version 35 (#24742)
(cherry picked from commit 831740ccc6d2fe3257ab0188ea5f935669142bb8)
---
build/run_unit_group.sh | 2 +-
buildtools/pom.xml | 2 +-
pom.xml | 2 +-
pulsar-bom/pom.xml | 2 +-
4 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/build/run_unit_group.sh b/build/run_unit_group.sh
index 40f83efaf2f..02347648b94 100755
--- a/build/run_unit_group.sh
+++ b/build/run_unit_group.sh
@@ -171,7 +171,7 @@ function test_group_proxy() {
function test_group_other() {
mvn_test --clean --install \
- -pl '!org.apache.pulsar:distribution,!org.apache.pulsar:pulsar-offloader-distribution,!org.apache.pulsar:pulsar-server-distribution,!org.apache.pulsar:pulsar-io-distribution,!org.apache.pulsar:pulsar-all-docker-image' \
+ -pl '!org.apache.pulsar:distribution,!org.apache.pulsar:pulsar-offloader-distribution,!org.apache.pulsar:pulsar-server-distribution,!org.apache.pulsar:pulsar-io-distribution,!org.apache.pulsar:pulsar-docker-image,!org.apache.pulsar:pulsar-all-docker-image' \
-PskipTestsForUnitGroupOther -DdisableIoMainProfile=true -DskipIntegrationTests \
-Dexclude='**/ManagedLedgerTest.java,
**/OffloadersCacheTest.java
diff --git a/buildtools/pom.xml b/buildtools/pom.xml
index 55c075256f5..95065cf7da5 100644
--- a/buildtools/pom.xml
+++ b/buildtools/pom.xml
@@ -25,7 +25,7 @@
<parent>
<groupId>org.apache</groupId>
<artifactId>apache</artifactId>
- <version>29</version>
+ <version>35</version>
<relativePath />
</parent>
diff --git a/pom.xml b/pom.xml
index 17376a72b75..b23720fd2f8 100644
--- a/pom.xml
+++ b/pom.xml
@@ -26,7 +26,7 @@
<parent>
<groupId>org.apache</groupId>
<artifactId>apache</artifactId>
- <version>29</version>
+ <version>35</version>
</parent>
<groupId>org.apache.pulsar</groupId>
diff --git a/pulsar-bom/pom.xml b/pulsar-bom/pom.xml
index c0d57ddc527..4a5a2d9c498 100644
--- a/pulsar-bom/pom.xml
+++ b/pulsar-bom/pom.xml
@@ -27,7 +27,7 @@
<parent>
<groupId>org.apache</groupId>
<artifactId>apache</artifactId>
- <version>29</version>
+ <version>35</version>
<relativePath/>
</parent>