You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by zh...@apache.org on 2026/01/29 04:02:00 UTC

(pulsar) branch branch-4.0 updated (92618695322 -> 71a39947550)

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

zhaocong pushed a change to branch branch-4.0
in repository https://gitbox.apache.org/repos/asf/pulsar.git


    from 92618695322 [fix][ml] Fix NoSuchElementException in EntryCountEstimator caused by a race condition (#25177)
     new 2c3402e56a5 [fix][test] Bump org.assertj:assertj-core from 3.27.5 to 3.27.7 (#25186)
     new 304fea1a88f [improve][misc] Upgrade snappy version to 1.1.10.8 (#25182)
     new c06f8baf700 [fix][proxy] Close client connection immediately when credentials expire and forwardAuthorizationCredentials is disabled (#25179)
     new b41488d7e86 [fix][client] ControlledClusterFailover avoid unnecessary reconnection. (#25178)
     new b53206829c5 [fix][sec] Bump org.apache.solr:solr-core from 9.8.0 to 9.10.1 in /pulsar-io/solr (#25175)
     new d81d6b38bec [improve][pip] PIP-453: Improve the metadata store threading model (#25173)
     new 71a39947550 [improve][client]Reduce unnecessary getPartitionedTopicMetadata requests when using retry and DLQ topics. (#25172)

The 7 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:
 distribution/server/src/assemble/LICENSE.bin.txt   |   2 +-
 pip/pip-453.md                                     |  98 ++++++++++++
 pom.xml                                            |   4 +-
 .../pulsar/client/api/DeadLetterTopicTest.java     |  90 +++++++++++
 .../pulsar/client/impl/ConsumerBuilderImpl.java    |  14 +-
 .../client/impl/ControlledClusterFailover.java     |  10 ++
 .../client/impl/ControlledClusterFailoverTest.java |  11 ++
 pulsar-io/solr/pom.xml                             |   3 +-
 .../pulsar/proxy/server/ProxyConnection.java       |  55 +++++--
 .../proxy/server/ProxyAuthenticationTest.java      | 175 ++++++++++++++++++---
 .../pulsar/proxy/server/ProxyRefreshAuthTest.java  |  48 +++---
 11 files changed, 442 insertions(+), 68 deletions(-)
 create mode 100644 pip/pip-453.md


(pulsar) 07/07: [improve][client]Reduce unnecessary getPartitionedTopicMetadata requests when using retry and DLQ topics. (#25172)

Posted by zh...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit 71a3994755063298368f738ea47882aba3f92f6a
Author: zhenJiangWang <zh...@gmail.com>
AuthorDate: Tue Jan 27 21:04:27 2026 +0800

    [improve][client]Reduce unnecessary getPartitionedTopicMetadata requests when using retry and DLQ topics. (#25172)
    
    (cherry picked from commit 52a4d5ee84fad6af2736376a6fcdd1bc41e7c52f)
---
 .../pulsar/client/api/DeadLetterTopicTest.java     | 90 ++++++++++++++++++++++
 .../pulsar/client/impl/ConsumerBuilderImpl.java    | 14 +++-
 2 files changed, 102 insertions(+), 2 deletions(-)

diff --git a/pulsar-broker/src/test/java/org/apache/pulsar/client/api/DeadLetterTopicTest.java b/pulsar-broker/src/test/java/org/apache/pulsar/client/api/DeadLetterTopicTest.java
index f5bf31369d8..001edb4de4f 100644
--- a/pulsar-broker/src/test/java/org/apache/pulsar/client/api/DeadLetterTopicTest.java
+++ b/pulsar-broker/src/test/java/org/apache/pulsar/client/api/DeadLetterTopicTest.java
@@ -19,6 +19,15 @@
 package org.apache.pulsar.client.api;
 
 import static org.assertj.core.api.Assertions.assertThat;
+import static org.mockito.ArgumentMatchers.any;
+import static org.mockito.ArgumentMatchers.anyBoolean;
+import static org.mockito.ArgumentMatchers.anyString;
+import static org.mockito.ArgumentMatchers.eq;
+import static org.mockito.Mockito.clearInvocations;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.times;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
 import static org.testng.Assert.assertEquals;
 import static org.testng.Assert.assertNotNull;
 import static org.testng.Assert.assertNull;
@@ -48,7 +57,11 @@ import org.apache.pulsar.client.impl.ConsumerBuilderImpl;
 import org.apache.pulsar.client.impl.ConsumerImpl;
 import org.apache.pulsar.client.impl.MultiTopicsConsumerImpl;
 import org.apache.pulsar.client.impl.ProducerImpl;
+import org.apache.pulsar.client.impl.PulsarClientImpl;
+import org.apache.pulsar.client.impl.conf.ClientConfigurationData;
+import org.apache.pulsar.client.impl.conf.ConsumerConfigurationData;
 import org.apache.pulsar.client.util.RetryMessageUtil;
+import org.apache.pulsar.common.partition.PartitionedTopicMetadata;
 import org.apache.pulsar.common.policies.data.SchemaCompatibilityStrategy;
 import org.awaitility.Awaitility;
 import org.slf4j.Logger;
@@ -1608,4 +1621,81 @@ public class DeadLetterTopicTest extends ProducerConsumerBase {
         consumer.close();
         deadLetterConsumer.close();
     }
+
+    @Test
+    public void testCheckUnnecessaryGetPartitionedTopicMetadataWhenUseRetryAndDQL() {
+        PulsarClientImpl client = mock(PulsarClientImpl.class);
+        ClientConfigurationData clientConf = new ClientConfigurationData();
+        when(client.getConfiguration()).thenReturn(clientConf);
+        when(client.getPartitionedTopicMetadata(anyString(), anyBoolean(), anyBoolean()))
+                .thenReturn(CompletableFuture.completedFuture(new PartitionedTopicMetadata(0)));
+        when(client.subscribeAsync(any(ConsumerConfigurationData.class), any(), any()))
+                .thenReturn(CompletableFuture.completedFuture(mock(Consumer.class)));
+
+        // Case 1: DeadLetterPolicy is null
+        ConsumerBuilderImpl<byte[]> consumerBuilder1 = new ConsumerBuilderImpl<>(client, Schema.BYTES);
+        consumerBuilder1.topic("persistent://public/default/test");
+        consumerBuilder1.subscriptionName("sub");
+        consumerBuilder1.enableRetry(true);
+        consumerBuilder1.subscribeAsync();
+
+        verify(client, times(1)).getPartitionedTopicMetadata(
+                eq("persistent://public/default/sub-RETRY"), anyBoolean(), anyBoolean());
+        verify(client, times(1)).getPartitionedTopicMetadata(
+                eq("persistent://public/default/sub-DLQ"), anyBoolean(), anyBoolean());
+
+        clearInvocations(client);
+
+        // Case 2: DeadLetterPolicy with custom Retry topic
+        ConsumerBuilderImpl<byte[]> consumerBuilder2 = new ConsumerBuilderImpl<>(client, Schema.BYTES);
+        consumerBuilder2.topic("persistent://public/default/test");
+        consumerBuilder2.subscriptionName("sub");
+        consumerBuilder2.enableRetry(true);
+        consumerBuilder2.deadLetterPolicy(DeadLetterPolicy.builder()
+                .maxRedeliverCount(10)
+                .retryLetterTopic("persistent://public/default/topic-retry")
+                .build());
+        consumerBuilder2.subscribeAsync();
+
+        verify(client, times(0)).getPartitionedTopicMetadata(
+                eq("persistent://public/default/sub-RETRY"), anyBoolean(), anyBoolean());
+        verify(client, times(1)).getPartitionedTopicMetadata(
+                eq("persistent://public/default/sub-DLQ"), anyBoolean(), anyBoolean());
+
+        clearInvocations(client);
+
+        // Case 3: DeadLetterPolicy with custom DLQ topic
+        ConsumerBuilderImpl<byte[]> consumerBuilder3 = new ConsumerBuilderImpl<>(client, Schema.BYTES);
+        consumerBuilder3.topic("persistent://public/default/test");
+        consumerBuilder3.subscriptionName("sub");
+        consumerBuilder3.enableRetry(true);
+        consumerBuilder3.deadLetterPolicy(DeadLetterPolicy.builder()
+                .maxRedeliverCount(10)
+                .deadLetterTopic("persistent://public/default/topic-dlq")
+                .build());
+        consumerBuilder3.subscribeAsync();
+
+        verify(client, times(1)).getPartitionedTopicMetadata(
+                eq("persistent://public/default/sub-RETRY"), anyBoolean(), anyBoolean());
+        verify(client, times(0)).getPartitionedTopicMetadata(
+                eq("persistent://public/default/sub-DLQ"), anyBoolean(), anyBoolean());
+
+        clearInvocations(client);
+
+        // Case 4: DeadLetterPolicy with both custom topics
+        ConsumerBuilderImpl<byte[]> consumerBuilder4 = new ConsumerBuilderImpl<>(client, Schema.BYTES);
+        consumerBuilder4.topic("persistent://public/default/test");
+        consumerBuilder4.subscriptionName("sub");
+        consumerBuilder4.enableRetry(true);
+        consumerBuilder4.deadLetterPolicy(DeadLetterPolicy.builder()
+                .maxRedeliverCount(10)
+                .retryLetterTopic("custom-retry")
+                .deadLetterTopic("custom-dlq")
+                .build());
+        consumerBuilder4.subscribeAsync();
+
+        verify(client, times(0)).getPartitionedTopicMetadata(anyString(), anyBoolean(), anyBoolean());
+    }
+
+
 }
diff --git a/pulsar-client/src/main/java/org/apache/pulsar/client/impl/ConsumerBuilderImpl.java b/pulsar-client/src/main/java/org/apache/pulsar/client/impl/ConsumerBuilderImpl.java
index ab64119cb8f..50addea57d1 100644
--- a/pulsar-client/src/main/java/org/apache/pulsar/client/impl/ConsumerBuilderImpl.java
+++ b/pulsar-client/src/main/java/org/apache/pulsar/client/impl/ConsumerBuilderImpl.java
@@ -163,8 +163,18 @@ public class ConsumerBuilderImpl<T> implements ConsumerBuilder<T> {
             DeadLetterPolicy deadLetterPolicy = conf.getDeadLetterPolicy();
             if (deadLetterPolicy == null || StringUtils.isBlank(deadLetterPolicy.getRetryLetterTopic())
                     || StringUtils.isBlank(deadLetterPolicy.getDeadLetterTopic())) {
-                CompletableFuture<Boolean> retryLetterTopicMetadata = checkDlqAlreadyExists(oldRetryLetterTopic);
-                CompletableFuture<Boolean> deadLetterTopicMetadata = checkDlqAlreadyExists(oldDeadLetterTopic);
+                CompletableFuture<Boolean> retryLetterTopicMetadata;
+                if (deadLetterPolicy == null || StringUtils.isBlank(deadLetterPolicy.getRetryLetterTopic())) {
+                    retryLetterTopicMetadata = checkDlqAlreadyExists(oldRetryLetterTopic);
+                } else {
+                    retryLetterTopicMetadata = CompletableFuture.completedFuture(false);
+                }
+                CompletableFuture<Boolean> deadLetterTopicMetadata;
+                if (deadLetterPolicy == null || StringUtils.isBlank(deadLetterPolicy.getDeadLetterTopic())) {
+                    deadLetterTopicMetadata = checkDlqAlreadyExists(oldDeadLetterTopic);
+                } else {
+                    deadLetterTopicMetadata = CompletableFuture.completedFuture(false);
+                }
                 applyDLQConfig = CompletableFuture.allOf(retryLetterTopicMetadata, deadLetterTopicMetadata)
                         .thenAccept(__ -> {
                             String retryLetterTopic = RetryMessageUtil.getRetryTopic(topicFirst.toString(),


(pulsar) 06/07: [improve][pip] PIP-453: Improve the metadata store threading model (#25173)

Posted by zh...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit d81d6b38becd86abbf4fbe3563ae852520f318a8
Author: Yunze Xu <xy...@163.com>
AuthorDate: Mon Jan 26 20:01:44 2026 +0800

    [improve][pip] PIP-453: Improve the metadata store threading model (#25173)
    
    (cherry picked from commit c51346fa3f5ec9cdd04ad03ba5d6b05b6c9a4f35)
---
 pip/pip-453.md | 98 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 98 insertions(+)

diff --git a/pip/pip-453.md b/pip/pip-453.md
new file mode 100644
index 00000000000..a42736b9dda
--- /dev/null
+++ b/pip/pip-453.md
@@ -0,0 +1,98 @@
+# PIP-453: Improve the metadata store threading model
+
+# Background knowledge
+
+The `pulsar-metadata` module provides two abstractions for interacting with metadata stores:
+- `MetadataStore`: the wrapper on the actual underlying metadata store (e.g. ZooKeeper), which has caches for value and children of a given key.
+- `MetadataCache<T>`: a typed cache layer on top of `MetadataStore`, which performs serialization and deserialization of data between `T` and `byte[]`.
+
+The `MetadataStore` instance is unique in each broker, and is shared by multiple `MetadataCache<T>` instances.
+
+However, a single thread whose name starts with the metadata store name (e.g. `ZK-MetadataStore`) is used by implementations of them. This thread is used in the following tasks:
+1. Executing callbacks of APIs like `put`.
+2. Executing notification handlers, including `AbstractMetadataStore#accept`, which calls `accept` methods of all `MetadataCache` instances and all listeners registered by `MetadataStore#registerListener`.
+3. For ZooKeeper and Etcd, which support batching requests, it's used to schedule flushing tasks at a fixed rate, which is determined by the `metadataStoreBatchingMaxDelayMillis` config (default: 5 ms).
+4. Scheduling some other tasks, e.g. retrying failed operations.
+
+It should be noted that `MetadataCache` executes the compute sensitive tasks like serialization in the `MetadataStore` callback. When the number of metadata operations grows, this thread is easy to be overwhelmed. It also affects the topic loading, which involves many metadata operations, this thread can be overwhelmed and block other tasks. For example, in a production environment, it's observed that the `pulsar_batch_metadata_store_queue_wait_time` metric is high (100 ms), which should [...]
+
+# Motivation
+
+The single thread model is inefficient when there are many metadata operations. For example, when a broker is down and the topics owned by this broker will be transferred to the new owner broker. Since the new owner broker might never owned them before, even the `MetadataCache` caches are cold, which results in many metadata operations. However, the CPU-bound tasks like serialization and deserialization are executed in the `MetadataStore` thread, which makes it easy to be overwhelmed. Th [...]
+
+In a production environment, there is a case when the metadata operation rate increased suddenly, the `pulsar_batch_metadata_store_queue_wait_time_ms_bucket` metric increased to ~100 ms, which is a part of the total latency of a metadata operation. As a result, the total P99 get latency (`pulsar_metadata_store_ops_latency_ms_bucket{type="get"}`) increased to 2 seconds.
+
+The 3rd task in the previous section is scheduled via `scheduleAtFixedRate`, which means if the task is not executed in time (5 ms by default), the task will be executed immediately again in a short time, which also burdens the single metadata store thread.
+
+# Goals
+
+## In Scope
+
+Improve the existing thread model to handle various tasks on metadata store, which could avoid a single thread being overwhelmed when there are many metadata operations.
+
+## Out of Scope
+
+Actually the batching mechanism introduced by [#13043](https://github.com/apache/pulsar/pull/13043) is harmful. The `flush` method, which is responsible to send a batch of metadata operations to broker, is called in the metadata store thread rather than the caller thread. The trade-off of the higher throughput is the lower latency. The benefit is limited because in most time the metadata operation rate is not so high. See this [test report](https://github.com/BewareMyPower/zookeeper-benc [...]
+
+This proposal doesn't intend to change the existing batching mechanism or disable it by default. It only improves the threading model to avoid the single thread being overwhelmed.
+
+Additionally, some code paths execute the compute intensive tasks in the metadata store thread directly (e.g. `store.get(path).thenApply(/* ... */)`), this proposal does not aim at changing them to asynchronous methods (e.g. `thenApplyAsync`).
+
+# High Level Design
+
+Create 3 set of threads:
+- `<name>-event`: the original metadata store thread, which is now only responsible to handle notifications. This executor won't be a `ScheduledExecutorService` anymore.
+- `<name>-batch-flusher`: a single thread, which is used to schedule the flushing task at a fixed rate. It won't be created if `metadataStoreBatchingEnabled` is false.
+- `<name>-worker`: a fixed thread pool shared by all `MetadataCache` instances to execute compute intensive tasks like serialization and deserialization. The same path will be handled by the same thread to keep the processing order on the same path.
+
+Regarding the callbacks, don't switch to a different thread. This change is not breaking because the underlying metadata store usually executes the callback in a single thread (e.g. `<name>-EventThread` in ZooKeeper) like the single thread in the current implementation. The caller should be responsible to manage worker threads on the metadata operation result if the callback is compute intensive.
+
+The only concern is that introducing a new thread to execute callbacks allows waiting for the future of metadata store APIs in the callback. After this change, the following use case could be a dead lock:
+
+```java
+metadataStore.get(path).thenApply(__ -> metadataStore.get(otherPath).join());;
+```
+
+Other tasks like the retry on failure is executed in JVM's common `ForkJoinPool` by `CompletableFuture` APIs. For example:
+
+```diff
+--- a/pulsar-metadata/src/main/java/org/apache/pulsar/metadata/impl/ZKMetadataStore.java
++++ b/pulsar-metadata/src/main/java/org/apache/pulsar/metadata/impl/ZKMetadataStore.java
+@@ -245,9 +245,8 @@ public class ZKMetadataStore extends AbstractBatchedMetadataStore
+                                 countsByType, totalSize, opsForLog);
+
+                         // Retry with the individual operations
+-                        executor.schedule(() -> {
+-                            ops.forEach(o -> batchOperation(Collections.singletonList(o)));
+-                        }, 100, TimeUnit.MILLISECONDS);
++                        CompletableFuture.delayedExecutor(100, TimeUnit.MILLISECONDS).execute(() ->
++                                ops.forEach(o -> batchOperation(Collections.singletonList(o))));
+                     } else {
+                         MetadataStoreException e = getException(code, path);
+                         ops.forEach(o -> o.getFuture().completeExceptionally(e));
+```
+
+# Detailed Design
+
+## Public-facing Changes
+
+### Configuration
+
+Add a configurations to specify the number of worker threads for `MetadataCache`:
+
+```java
+    @FieldContext(
+            category = CATEGORY_SERVER,
+            doc = "The number of threads uses for serializing and deserializing data to and from the metadata store"
+    )
+    private int metadataStoreSerDesThreads = Runtime.getRuntime().availableProcessors();
+```
+
+### Metrics
+
+The `pulsar_batch_metadata_store_executor_queue_size` metric will be removed because the `<name>-batch-flusher` thread won't execute other tasks except for flushing.
+
+# Links
+
+* Mailing List discussion thread: https://lists.apache.org/thread/0cfdyvj96gw1sp1mo2zghl0lmsms5w1d
+* Mailing List voting thread: https://lists.apache.org/thread/cktj2k8myw076yggn63k8yxs5357yd61


(pulsar) 05/07: [fix][sec] Bump org.apache.solr:solr-core from 9.8.0 to 9.10.1 in /pulsar-io/solr (#25175)

Posted by zh...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit b53206829c50f8c82dd1fc4692fe0ac2b4e0a6bd
Author: dependabot[bot] <49...@users.noreply.github.com>
AuthorDate: Fri Jan 23 08:47:37 2026 +0200

    [fix][sec] Bump org.apache.solr:solr-core from 9.8.0 to 9.10.1 in /pulsar-io/solr (#25175)
    
    Signed-off-by: dependabot[bot] <su...@github.com>
    Co-authored-by: dependabot[bot] <49...@users.noreply.github.com>
    (cherry picked from commit a2f888a0d1e196f05c662f2771125d80d982c548)
---
 pulsar-io/solr/pom.xml | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/pulsar-io/solr/pom.xml b/pulsar-io/solr/pom.xml
index 2cea9a5ddc0..8f889b94c2f 100644
--- a/pulsar-io/solr/pom.xml
+++ b/pulsar-io/solr/pom.xml
@@ -29,7 +29,8 @@
     </parent>
 
     <properties>
-        <solr.version>9.8.0</solr.version>
+        <solr.version>9.10.1</solr.version>
+        <jetty10.version>10.0.24</jetty10.version>
     </properties>
 
     <artifactId>pulsar-io-solr</artifactId>


(pulsar) 01/07: [fix][test] Bump org.assertj:assertj-core from 3.27.5 to 3.27.7 (#25186)

Posted by zh...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit 2c3402e56a5b086a05fb6c9feeb7870c6d8c0b6b
Author: dependabot[bot] <49...@users.noreply.github.com>
AuthorDate: Tue Jan 27 13:12:01 2026 +0200

    [fix][test] Bump org.assertj:assertj-core from 3.27.5 to 3.27.7 (#25186)
    
    Signed-off-by: dependabot[bot] <su...@github.com>
    Co-authored-by: dependabot[bot] <49...@users.noreply.github.com>
    (cherry picked from commit ce4ebeaa7d1624cd4dd7814435700448e620e2d7)
---
 pom.xml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/pom.xml b/pom.xml
index ed5cc91ac8c..3a6e5800967 100644
--- a/pom.xml
+++ b/pom.xml
@@ -272,7 +272,7 @@ flexible messaging model and an intuitive client API.</description>
     <jline3.version>3.21.0</jline3.version>
     <hppc.version>0.9.1</hppc.version>
     <spark-streaming_2.10.version>2.1.0</spark-streaming_2.10.version>
-    <assertj-core.version>3.27.5</assertj-core.version>
+    <assertj-core.version>3.27.7</assertj-core.version>
     <lombok.version>1.18.42</lombok.version>
     <jakarta.annotation-api.version>1.3.5</jakarta.annotation-api.version>
     <jaxb-api>2.3.1</jaxb-api>


(pulsar) 03/07: [fix][proxy] Close client connection immediately when credentials expire and forwardAuthorizationCredentials is disabled (#25179)

Posted by zh...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit c06f8baf70041ece152ea06d845e78b3bfdbdb1e
Author: Zixuan Liu <no...@gmail.com>
AuthorDate: Sat Jan 24 11:20:40 2026 +0800

    [fix][proxy] Close client connection immediately when credentials expire and forwardAuthorizationCredentials is disabled (#25179)
    
    (cherry picked from commit 334847073e2c926eac5c486a5cfda1d1dd42634a)
---
 .../pulsar/proxy/server/ProxyConnection.java       |  55 +++++--
 .../proxy/server/ProxyAuthenticationTest.java      | 175 ++++++++++++++++++---
 .../pulsar/proxy/server/ProxyRefreshAuthTest.java  |  48 +++---
 3 files changed, 216 insertions(+), 62 deletions(-)

diff --git a/pulsar-proxy/src/main/java/org/apache/pulsar/proxy/server/ProxyConnection.java b/pulsar-proxy/src/main/java/org/apache/pulsar/proxy/server/ProxyConnection.java
index 4f89f4bc17e..2512f8af2be 100644
--- a/pulsar-proxy/src/main/java/org/apache/pulsar/proxy/server/ProxyConnection.java
+++ b/pulsar-proxy/src/main/java/org/apache/pulsar/proxy/server/ProxyConnection.java
@@ -147,7 +147,12 @@ public class ProxyConnection extends PulsarHandler {
 
         Closing,
 
-        Closed,
+        Closed;
+
+        boolean isAuthenticatedState() {
+            return this == ProxyLookupRequests
+                    || this == ProxyConnectionToBroker;
+        }
     }
 
     ConnectionPool getConnectionPool() {
@@ -406,15 +411,7 @@ public class ProxyConnection extends PulsarHandler {
 
             state = State.ProxyLookupRequests;
             lookupProxyHandler = service.newLookupProxyHandler(this);
-            if (service.getConfiguration().isAuthenticationEnabled()
-                    && service.getConfiguration().getAuthenticationRefreshCheckSeconds() > 0) {
-                authRefreshTask = ctx.executor().scheduleAtFixedRate(
-                        Runnables.catchingAndLoggingThrowables(
-                                this::refreshAuthenticationCredentialsAndCloseIfTooExpired),
-                        service.getConfiguration().getAuthenticationRefreshCheckSeconds(),
-                        service.getConfiguration().getAuthenticationRefreshCheckSeconds(),
-                        TimeUnit.SECONDS);
-            }
+            startAuthRefreshTaskIfNotStarted();
             final ByteBuf msg = Commands.newConnected(protocolVersionToAdvertise, false);
             writeAndFlush(msg);
         }
@@ -430,6 +427,10 @@ public class ProxyConnection extends PulsarHandler {
             final ByteBuf msg = Commands.newConnected(connected.getProtocolVersion(), maxMessageSize,
                     connected.hasFeatureFlags() && connected.getFeatureFlags().isSupportsTopicWatchers());
             writeAndFlush(msg);
+            // Start auth refresh task only if we are not forwarding authorization credentials
+            if (!service.getConfiguration().isForwardAuthorizationCredentials()) {
+                startAuthRefreshTaskIfNotStarted();
+            }
         } else {
             LOG.warn("[{}] Channel is {}. ProxyConnection is in {}. "
                             + "Closing connection to broker '{}'.",
@@ -511,16 +512,44 @@ public class ProxyConnection extends PulsarHandler {
         }
     }
 
+    private void startAuthRefreshTaskIfNotStarted() {
+        if (service.getConfiguration().isAuthenticationEnabled()
+                && service.getConfiguration().getAuthenticationRefreshCheckSeconds() > 0
+                && authRefreshTask == null) {
+            authRefreshTask = ctx.executor().scheduleAtFixedRate(
+                    Runnables.catchingAndLoggingThrowables(
+                            this::refreshAuthenticationCredentialsAndCloseIfTooExpired),
+                    service.getConfiguration().getAuthenticationRefreshCheckSeconds(),
+                    service.getConfiguration().getAuthenticationRefreshCheckSeconds(),
+                    TimeUnit.SECONDS);
+        }
+    }
+
     private void refreshAuthenticationCredentialsAndCloseIfTooExpired() {
         assert ctx.executor().inEventLoop();
-        if (state != State.ProxyLookupRequests) {
-            // Happens when an exception is thrown that causes this connection to close.
+
+        // Only check expiration in authenticated states
+        if (!state.isAuthenticatedState()) {
             return;
-        } else if (!authState.isExpired()) {
+        }
+
+        if (!authState.isExpired()) {
             // Credentials are still valid. Nothing to do at this point
             return;
         }
 
+        // If we are not forwarding authorization credentials to the broker, the broker cannot
+        // refresh the client's credentials. In this case, we must close the connection immediately
+        // when credentials expire.
+        if (!service.getConfiguration().isForwardAuthorizationCredentials()) {
+            if (LOG.isDebugEnabled()) {
+                LOG.debug("[{}] Closing connection because client credentials have expired and "
+                        + "forwardAuthorizationCredentials is disabled (broker cannot refresh)", remoteAddress);
+            }
+            ctx.close();
+            return;
+        }
+
         if (System.nanoTime() - authChallengeSentTime
                 > TimeUnit.SECONDS.toNanos(service.getConfiguration().getAuthenticationRefreshCheckSeconds())) {
             LOG.warn("[{}] Closing connection after timeout on refreshing auth credentials", remoteAddress);
diff --git a/pulsar-proxy/src/test/java/org/apache/pulsar/proxy/server/ProxyAuthenticationTest.java b/pulsar-proxy/src/test/java/org/apache/pulsar/proxy/server/ProxyAuthenticationTest.java
index 6887e9ea234..04529629de7 100644
--- a/pulsar-proxy/src/test/java/org/apache/pulsar/proxy/server/ProxyAuthenticationTest.java
+++ b/pulsar-proxy/src/test/java/org/apache/pulsar/proxy/server/ProxyAuthenticationTest.java
@@ -18,11 +18,15 @@
  */
 package org.apache.pulsar.proxy.server;
 
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.assertj.core.api.Assertions.assertThatThrownBy;
 import static org.mockito.Mockito.spy;
 import com.google.common.collect.Sets;
 import com.google.gson.JsonObject;
 import com.google.gson.JsonParser;
 import java.io.IOException;
+import java.net.SocketAddress;
+import java.nio.charset.StandardCharsets;
 import java.util.HashMap;
 import java.util.HashSet;
 import java.util.Map;
@@ -30,12 +34,16 @@ import java.util.Map.Entry;
 import java.util.Optional;
 import java.util.Set;
 import java.util.concurrent.CompletableFuture;
+import java.util.concurrent.TimeUnit;
 import javax.naming.AuthenticationException;
+import javax.net.ssl.SSLSession;
 import lombok.Cleanup;
 import org.apache.pulsar.broker.ServiceConfiguration;
+import org.apache.pulsar.broker.authentication.AuthenticationDataCommand;
 import org.apache.pulsar.broker.authentication.AuthenticationDataSource;
 import org.apache.pulsar.broker.authentication.AuthenticationProvider;
 import org.apache.pulsar.broker.authentication.AuthenticationService;
+import org.apache.pulsar.broker.authentication.AuthenticationState;
 import org.apache.pulsar.client.admin.PulsarAdmin;
 import org.apache.pulsar.client.api.Authentication;
 import org.apache.pulsar.client.api.AuthenticationDataProvider;
@@ -44,8 +52,11 @@ import org.apache.pulsar.client.api.ProducerConsumerBase;
 import org.apache.pulsar.client.api.PulsarClient;
 import org.apache.pulsar.client.api.PulsarClientException;
 import org.apache.pulsar.client.api.Schema;
+import org.apache.pulsar.client.impl.ProducerImpl;
+import org.apache.pulsar.common.api.AuthData;
 import org.apache.pulsar.common.configuration.PulsarConfigurationLoader;
 import org.apache.pulsar.common.policies.data.AuthAction;
+import org.awaitility.Awaitility;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.testng.Assert;
@@ -80,6 +91,7 @@ public class ProxyAuthenticationTest extends ProducerConsumerBase {
         public Set<Entry<String, String>> getHttpHeaders() {
             Map<String, String> headers = new HashMap<>();
             headers.put("BasicAuthentication", authParam);
+            headers.put("X-Pulsar-Auth-Method-Name", "BasicAuthentication");
             return headers.entrySet();
         }
     }
@@ -119,6 +131,72 @@ public class ProxyAuthenticationTest extends ProducerConsumerBase {
         }
     }
 
+    public static class BasicAuthenticationState implements AuthenticationState {
+        private final long expiryTimeInMillis;
+        private final String authRole;
+        private final AuthenticationDataSource authenticationDataSource;
+
+        private static boolean isExpired(long expiryTimeInMillis) {
+            return System.currentTimeMillis() > expiryTimeInMillis;
+        }
+
+        private static String[] parseAuthData(String commandData) {
+            JsonObject element = JsonParser.parseString(commandData).getAsJsonObject();
+            long expiryTimeInMillis = Long.parseLong(element.get("expiryTime").getAsString());
+            if (isExpired(expiryTimeInMillis)) {
+                throw new IllegalArgumentException("Credentials have expired");
+            }
+            String role = element.get("entityType").getAsString();
+            return new String[]{role, String.valueOf(expiryTimeInMillis)};
+        }
+
+        public BasicAuthenticationState(AuthenticationDataSource authData) {
+            this(authData.hasDataFromCommand() ? authData.getCommandData()
+                    : authData.getHttpHeader("BasicAuthentication"));
+        }
+
+        public BasicAuthenticationState(AuthData authData) {
+            this(new String(authData.getBytes(), StandardCharsets.UTF_8));
+        }
+
+        private BasicAuthenticationState(String commandData) {
+            String[] parsed = parseAuthData(commandData);
+            this.authRole = parsed[0];
+            this.expiryTimeInMillis = Long.parseLong(parsed[1]);
+            this.authenticationDataSource = new AuthenticationDataCommand(commandData, null, null);
+        }
+
+        @Override
+        public String getAuthRole() {
+            return authRole;
+        }
+
+        @Override
+        public AuthData authenticate(AuthData authData) throws AuthenticationException {
+            return null; // Authentication complete
+        }
+
+        @Override
+        public CompletableFuture<AuthData> authenticateAsync(AuthData authData) {
+            return CompletableFuture.completedFuture(null); // Authentication complete
+        }
+
+        @Override
+        public AuthenticationDataSource getAuthDataSource() {
+            return authenticationDataSource;
+        }
+
+        @Override
+        public boolean isComplete() {
+            return authRole != null;
+        }
+
+        @Override
+        public boolean isExpired() {
+            return isExpired(expiryTimeInMillis);
+        }
+    }
+
     public static class BasicAuthenticationProvider implements AuthenticationProvider {
 
         @Override
@@ -135,26 +213,14 @@ public class ProxyAuthenticationTest extends ProducerConsumerBase {
         }
 
         @Override
-        public CompletableFuture<String> authenticateAsync(AuthenticationDataSource authData) {
-            String commandData = null;
-            if (authData.hasDataFromCommand()) {
-                commandData = authData.getCommandData();
-            } else if (authData.hasDataFromHttp()) {
-                commandData = authData.getHttpHeader("BasicAuthentication");
-            }
+        public AuthenticationState newAuthState(AuthData authData, SocketAddress remoteAddress, SSLSession sslSession) {
+            return new BasicAuthenticationState(authData);
+        }
 
-            JsonObject element = JsonParser.parseString(commandData).getAsJsonObject();
-            log.info("Have log of {}", element);
-            long expiryTimeInMillis = Long.parseLong(element.get("expiryTime").getAsString());
-            long currentTimeInMillis = System.currentTimeMillis();
-            if (expiryTimeInMillis < currentTimeInMillis) {
-                log.warn("Auth failed due to timeout");
-                return CompletableFuture
-                        .failedFuture(new AuthenticationException("Authentication data has been expired"));
-            }
-            final String result = element.get("entityType").getAsString();
-            // Run in another thread to attempt to test the async logic
-            return CompletableFuture.supplyAsync(() -> result);
+        @Override
+        public CompletableFuture<String> authenticateAsync(AuthenticationDataSource authData) {
+            BasicAuthenticationState basicAuthenticationState = new BasicAuthenticationState(authData);
+            return CompletableFuture.supplyAsync(basicAuthenticationState::getAuthRole);
         }
     }
 
@@ -271,4 +337,75 @@ public class ProxyAuthenticationTest extends ProducerConsumerBase {
                 .authentication(BasicAuthentication.class.getName(), authParams)
                 .connectionsPerBroker(numberOfConnections).build();
     }
+
+    @Test
+    void testClientDisconnectWhenCredentialsExpireWithoutForwardAuth() throws Exception {
+        log.info("-- Starting {} test --", methodName);
+
+        String namespaceName = "my-property/my-ns";
+        String topicName = "persistent://my-property/my-ns/my-topic1";
+
+        admin.namespaces().grantPermissionOnNamespace(namespaceName, "proxy",
+                Sets.newHashSet(AuthAction.consume, AuthAction.produce));
+        admin.namespaces().grantPermissionOnNamespace(namespaceName, "client",
+                Sets.newHashSet(AuthAction.consume, AuthAction.produce));
+
+        // Important: When forwardAuthorizationCredentials=false, broker should not authenticate original auth data
+        // because the proxy doesn't forward it. Set authenticateOriginalAuthData=false to match this behavior.
+        conf.setAuthenticateOriginalAuthData(false);
+
+        ProxyConfiguration proxyConfig = new ProxyConfiguration();
+        proxyConfig.setAuthenticationEnabled(true);
+        proxyConfig.setAuthenticationRefreshCheckSeconds(2); // Check every 2 seconds
+        proxyConfig.setServicePort(Optional.of(0));
+        proxyConfig.setBrokerProxyAllowedTargetPorts("*");
+        proxyConfig.setWebServicePort(Optional.of(0));
+        proxyConfig.setBrokerServiceURL(pulsar.getBrokerServiceUrl());
+        proxyConfig.setClusterName(CLUSTER_NAME);
+
+        // Proxy auth with long expiry
+        String proxyAuthParams = "entityType:proxy,expiryTime:" + (System.currentTimeMillis() + 3600 * 1000);
+        proxyConfig.setBrokerClientAuthenticationPlugin(BasicAuthentication.class.getName());
+        proxyConfig.setBrokerClientAuthenticationParameters(proxyAuthParams);
+
+        Set<String> providers = new HashSet<>();
+        providers.add(BasicAuthenticationProvider.class.getName());
+        proxyConfig.setAuthenticationProviders(providers);
+        proxyConfig.setForwardAuthorizationCredentials(false);
+
+        @Cleanup
+        AuthenticationService authenticationService = new AuthenticationService(
+                PulsarConfigurationLoader.convertFrom(proxyConfig));
+        @Cleanup
+        final Authentication proxyClientAuthentication =
+                AuthenticationFactory.create(proxyConfig.getBrokerClientAuthenticationPlugin(),
+                proxyConfig.getBrokerClientAuthenticationParameters());
+        proxyClientAuthentication.start();
+        @Cleanup
+        ProxyService proxyService = new ProxyService(proxyConfig, authenticationService, proxyClientAuthentication);
+        proxyService.start();
+        final String proxyServiceUrl = proxyService.getServiceUrl();
+
+        // Create client with credentials that will expire in 3 seconds
+        long clientExpireTime = System.currentTimeMillis() + 3 * 1000;
+        String clientAuthParams = "entityType:client,expiryTime:" + clientExpireTime;
+
+        @Cleanup
+        PulsarClient proxyClient = createPulsarClient(proxyServiceUrl, clientAuthParams, 1);
+
+        @Cleanup
+        var producer =
+                proxyClient.newProducer(Schema.BYTES).topic(topicName).sendTimeout(5, TimeUnit.SECONDS).create();
+        producer.send("test message".getBytes());
+
+        Awaitility.await().untilAsserted(() -> {
+            assertThatThrownBy(() -> producer.send("test message after expiry".getBytes()))
+                    .isExactlyInstanceOf(PulsarClientException.TimeoutException.class);
+        });
+
+        if (producer instanceof ProducerImpl<byte[]> producerImpl) {
+            long lastDisconnectedTimestamp = producerImpl.getLastDisconnectedTimestamp();
+            assertThat(lastDisconnectedTimestamp).isGreaterThan(clientExpireTime);
+        }
+    }
 }
diff --git a/pulsar-proxy/src/test/java/org/apache/pulsar/proxy/server/ProxyRefreshAuthTest.java b/pulsar-proxy/src/test/java/org/apache/pulsar/proxy/server/ProxyRefreshAuthTest.java
index f3ff1362fd8..7501eb9306f 100644
--- a/pulsar-proxy/src/test/java/org/apache/pulsar/proxy/server/ProxyRefreshAuthTest.java
+++ b/pulsar-proxy/src/test/java/org/apache/pulsar/proxy/server/ProxyRefreshAuthTest.java
@@ -179,37 +179,25 @@ public class ProxyRefreshAuthTest extends ProducerConsumerBase {
 
         PulsarClientImpl pulsarClientImpl = (PulsarClientImpl) pulsarClient;
         pulsarClient.getPartitionsForTopic(topic).get();
-        Set<CompletableFuture<ClientCnx>> connections = pulsarClientImpl.getCnxPool().getConnections();
 
-        Awaitility.await().during(5, SECONDS).untilAsserted(() -> {
-            pulsarClient.getPartitionsForTopic(topic).get();
-            assertTrue(connections.stream().allMatch(n -> {
-                try {
-                    ClientCnx clientCnx = n.get();
-                    long timestamp = clientCnx.getLastDisconnectedTimestamp();
-                    return timestamp == 0;
-                } catch (Exception e) {
-                    throw new RuntimeException(e);
-                }
-            }));
-        });
+        // Verify initial connection state
+        Set<CompletableFuture<ClientCnx>> connections = pulsarClientImpl.getCnxPool().getConnections();
 
-        // Force all connections from proxy to broker to close and therefore require the proxy to re-authenticate with
-        // the broker. (The client doesn't lose this connection.)
-        restartBroker();
-
-        // Rerun assertion to ensure that it still works
-        Awaitility.await().during(5, SECONDS).untilAsserted(() -> {
-            pulsarClient.getPartitionsForTopic(topic).get();
-            assertTrue(connections.stream().allMatch(n -> {
-                try {
-                    ClientCnx clientCnx = n.get();
-                    long timestamp = clientCnx.getLastDisconnectedTimestamp();
-                    return timestamp == 0;
-                } catch (Exception e) {
-                    throw new RuntimeException(e);
-                }
-            }));
-        });
+        Awaitility.await()
+                .during(5, SECONDS)
+                .untilAsserted(() -> {
+                    for (CompletableFuture<ClientCnx> cf : connections) {
+                        try {
+                            ClientCnx clientCnx = cf.get();
+                            long timestamp = clientCnx.getLastDisconnectedTimestamp();
+                            // If forwardAuthData is false, the broker cannot see the client's authentication data.
+                            // As a result, the broker cannot perform any refresh operations on the client's auth data.
+                            // Only the proxy has visibility of the client's connection state.
+                            assertTrue(forwardAuthData ? timestamp == 0 : timestamp > 0);
+                        } catch (Exception e) {
+                            throw new AssertionError("Failed to get connection state", e);
+                        }
+                    }
+                });
     }
 }


(pulsar) 04/07: [fix][client] ControlledClusterFailover avoid unnecessary reconnection. (#25178)

Posted by zh...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit b41488d7e86d94703c40196894727d63ab02ddff
Author: Wenzhi Feng <th...@apache.org>
AuthorDate: Fri Jan 23 17:42:32 2026 +0800

    [fix][client] ControlledClusterFailover avoid unnecessary reconnection. (#25178)
    
    Co-authored-by: fengwenzhi <fe...@bigo.sg>
    (cherry picked from commit f0ec07b3d8c5cfe36942957fc0ad32e40d69320d)
---
 .../apache/pulsar/client/impl/ControlledClusterFailover.java  | 10 ++++++++++
 .../pulsar/client/impl/ControlledClusterFailoverTest.java     | 11 +++++++++++
 2 files changed, 21 insertions(+)

diff --git a/pulsar-client/src/main/java/org/apache/pulsar/client/impl/ControlledClusterFailover.java b/pulsar-client/src/main/java/org/apache/pulsar/client/impl/ControlledClusterFailover.java
index c52a70c6cd7..1d4740b8472 100644
--- a/pulsar-client/src/main/java/org/apache/pulsar/client/impl/ControlledClusterFailover.java
+++ b/pulsar-client/src/main/java/org/apache/pulsar/client/impl/ControlledClusterFailover.java
@@ -42,6 +42,7 @@ import org.apache.pulsar.client.api.AuthenticationFactory;
 import org.apache.pulsar.client.api.ControlledClusterFailoverBuilder;
 import org.apache.pulsar.client.api.PulsarClient;
 import org.apache.pulsar.client.api.ServiceUrlProvider;
+import org.apache.pulsar.client.impl.conf.ClientConfigurationData;
 import org.apache.pulsar.client.util.ExecutorProvider;
 import org.apache.pulsar.common.util.ObjectMapperFactory;
 import org.asynchttpclient.AsyncHttpClient;
@@ -109,6 +110,15 @@ public class ControlledClusterFailover implements ServiceUrlProvider {
     public void initialize(PulsarClient client) {
         this.pulsarClient = (PulsarClientImpl) client;
 
+        // Initialize currentControlledConfiguration from client's current configuration
+        // to avoid unnecessary reconnection on first scheduled check when the configuration hasn't changed
+        ClientConfigurationData conf = pulsarClient.getConfiguration();
+        this.currentControlledConfiguration = new ControlledConfiguration();
+        this.currentControlledConfiguration.setServiceUrl(currentPulsarServiceUrl);
+        this.currentControlledConfiguration.setTlsTrustCertsFilePath(conf.getTlsTrustCertsFilePath());
+        this.currentControlledConfiguration.setAuthPluginClassName(conf.getAuthPluginClassName());
+        this.currentControlledConfiguration.setAuthParamsString(conf.getAuthParams());
+
         // start to check service url every 30 seconds
         this.executor.scheduleAtFixedRate(catchingAndLoggingThrowables(() -> {
             ControlledConfiguration controlledConfiguration = null;
diff --git a/pulsar-client/src/test/java/org/apache/pulsar/client/impl/ControlledClusterFailoverTest.java b/pulsar-client/src/test/java/org/apache/pulsar/client/impl/ControlledClusterFailoverTest.java
index 265af6dd23c..86b2fa7cb4f 100644
--- a/pulsar-client/src/test/java/org/apache/pulsar/client/impl/ControlledClusterFailoverTest.java
+++ b/pulsar-client/src/test/java/org/apache/pulsar/client/impl/ControlledClusterFailoverTest.java
@@ -26,6 +26,7 @@ import java.util.concurrent.TimeUnit;
 import lombok.Cleanup;
 import org.apache.pulsar.client.api.Authentication;
 import org.apache.pulsar.client.api.ServiceUrlProvider;
+import org.apache.pulsar.client.impl.conf.ClientConfigurationData;
 import org.asynchttpclient.Request;
 import org.awaitility.Awaitility;
 import org.mockito.Mockito;
@@ -54,6 +55,14 @@ public class ControlledClusterFailoverTest {
             .build();
 
         ControlledClusterFailover controlledClusterFailover = (ControlledClusterFailover) provider;
+
+        PulsarClientImpl pulsarClient = mock(PulsarClientImpl.class);
+        ConnectionPool connectionPool = mock(ConnectionPool.class);
+        ClientConfigurationData clientConf = new ClientConfigurationData();
+        when(pulsarClient.getCnxPool()).thenReturn(connectionPool);
+        when(pulsarClient.getConfiguration()).thenReturn(clientConf);
+        controlledClusterFailover.initialize(pulsarClient);
+
         Request request = controlledClusterFailover.getRequestBuilder().build();
 
         Assert.assertTrue(provider instanceof ControlledClusterFailover);
@@ -91,7 +100,9 @@ public class ControlledClusterFailoverTest {
         ControlledClusterFailover controlledClusterFailover = Mockito.spy((ControlledClusterFailover) provider);
         PulsarClientImpl pulsarClient = mock(PulsarClientImpl.class);
         ConnectionPool connectionPool = mock(ConnectionPool.class);
+        ClientConfigurationData clientConf = new ClientConfigurationData();
         when(pulsarClient.getCnxPool()).thenReturn(connectionPool);
+        when(pulsarClient.getConfiguration()).thenReturn(clientConf);
 
         controlledClusterFailover.initialize(pulsarClient);
 


(pulsar) 02/07: [improve][misc] Upgrade snappy version to 1.1.10.8 (#25182)

Posted by zh...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit 304fea1a88f5ca91f011d3dd622c554bf34c70f5
Author: Lari Hotari <lh...@users.noreply.github.com>
AuthorDate: Sat Jan 24 10:11:10 2026 +0200

    [improve][misc] Upgrade snappy version to 1.1.10.8 (#25182)
    
    (cherry picked from commit b15f53b582546f47414edd9a680bd6980db2fd41)
---
 distribution/server/src/assemble/LICENSE.bin.txt | 2 +-
 pom.xml                                          | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/distribution/server/src/assemble/LICENSE.bin.txt b/distribution/server/src/assemble/LICENSE.bin.txt
index ee379ca3b04..c6e15f67ccf 100644
--- a/distribution/server/src/assemble/LICENSE.bin.txt
+++ b/distribution/server/src/assemble/LICENSE.bin.txt
@@ -506,7 +506,7 @@ The Apache Software License, Version 2.0
     - org.apache.zookeeper-zookeeper-jute-3.9.4.jar
     - org.apache.zookeeper-zookeeper-prometheus-metrics-3.9.4.jar
   * Snappy Java
-    - org.xerial.snappy-snappy-java-1.1.10.5.jar
+    - org.xerial.snappy-snappy-java-1.1.10.8.jar
   * Google HTTP Client
     - com.google.http-client-google-http-client-gson-1.41.0.jar
     - com.google.http-client-google-http-client-1.41.0.jar
diff --git a/pom.xml b/pom.xml
index 3a6e5800967..71a9c558995 100644
--- a/pom.xml
+++ b/pom.xml
@@ -181,7 +181,7 @@ flexible messaging model and an intuitive client API.</description>
     <zookeeper.version>3.9.4</zookeeper.version>
     <commons-cli.version>1.11.0</commons-cli.version>
     <commons-text.version>1.14.0</commons-text.version>
-    <snappy.version>1.1.10.5</snappy.version> <!-- ZooKeeper server -->
+    <snappy.version>1.1.10.8</snappy.version> <!-- ZooKeeper server -->
     <dropwizardmetrics.version>4.1.12.1</dropwizardmetrics.version> <!-- ZooKeeper server -->
     <curator.version>5.7.1</curator.version>
     <netty.version>4.1.130.Final</netty.version>