You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by bo...@apache.org on 2022/12/07 06:13:33 UTC

[pulsar] branch branch-2.9 updated (4f073541c3a -> 85e65aa93d9)

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

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


    from 4f073541c3a [fix][broker] Fix if dynamicConfig item in ZK do not exist in broker cause NPE (#17705)
     new acdb3e141ba [fix][client] Unwrap completion exception for Lookup Services (#17717)
     new 32b243e7605 [Improve][Auth]Update authentication failed metrics report (#17787)
     new 85e65aa93d9 [fix][broker] add return for PersistentMessageExpiryMonitor#findEntryFailed

The 3 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:
 .../authentication/AuthenticationProviderList.java |  8 +++++
 .../persistent/PersistentMessageExpiryMonitor.java |  1 +
 .../client/impl/BinaryProtoLookupService.java      | 36 ++++++++++++----------
 .../pulsar/client/impl/HttpLookupService.java      | 16 +++++-----
 4 files changed, 38 insertions(+), 23 deletions(-)


[pulsar] 02/03: [Improve][Auth]Update authentication failed metrics report (#17787)

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

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

commit 32b243e76057c2949bd57211c2f5bc961232c6d1
Author: Guangning E <gu...@streamnative.io>
AuthorDate: Mon Sep 26 13:02:08 2022 +0800

    [Improve][Auth]Update authentication failed metrics report (#17787)
    
    (cherry picked from commit 5068800d1f235fe293adf21a8c6000b48a2a54ad)
---
 .../pulsar/broker/authentication/AuthenticationProviderList.java  | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/pulsar-broker-common/src/main/java/org/apache/pulsar/broker/authentication/AuthenticationProviderList.java b/pulsar-broker-common/src/main/java/org/apache/pulsar/broker/authentication/AuthenticationProviderList.java
index 9ec1c2eb706..fc86a995921 100644
--- a/pulsar-broker-common/src/main/java/org/apache/pulsar/broker/authentication/AuthenticationProviderList.java
+++ b/pulsar-broker-common/src/main/java/org/apache/pulsar/broker/authentication/AuthenticationProviderList.java
@@ -28,6 +28,7 @@ import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.pulsar.broker.ServiceConfiguration;
+import org.apache.pulsar.broker.authentication.metrics.AuthenticationMetrics;
 import org.apache.pulsar.common.api.AuthData;
 
 /**
@@ -58,8 +59,15 @@ public class AuthenticationProviderList implements AuthenticationProvider {
         }
 
         if (null == authenticationException) {
+            AuthenticationMetrics.authenticateFailure(
+                    AuthenticationProviderList.class.getSimpleName(),
+                    "authentication-provider-list", "Authentication required");
             throw new AuthenticationException("Authentication required");
         } else {
+            AuthenticationMetrics.authenticateFailure(AuthenticationProviderList.class.getSimpleName(),
+                    "authentication-provider-list",
+                    authenticationException.getMessage() != null
+                            ? authenticationException.getMessage() : "Authentication required");
             throw authenticationException;
         }
 


[pulsar] 01/03: [fix][client] Unwrap completion exception for Lookup Services (#17717)

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

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

commit acdb3e141baefe398228929d8ee4f07835a382a3
Author: Penghui Li <pe...@apache.org>
AuthorDate: Tue Sep 20 15:54:31 2022 +0800

    [fix][client] Unwrap completion exception for Lookup Services (#17717)
    
    (cherry picked from commit 320300cd2e0c58ee96981996d254884a683b7dd4)
---
 .../client/impl/BinaryProtoLookupService.java      | 36 ++++++++++++----------
 .../pulsar/client/impl/HttpLookupService.java      | 16 +++++-----
 2 files changed, 29 insertions(+), 23 deletions(-)

diff --git a/pulsar-client/src/main/java/org/apache/pulsar/client/impl/BinaryProtoLookupService.java b/pulsar-client/src/main/java/org/apache/pulsar/client/impl/BinaryProtoLookupService.java
index ba3281c64cc..6b3912e24be 100644
--- a/pulsar-client/src/main/java/org/apache/pulsar/client/impl/BinaryProtoLookupService.java
+++ b/pulsar-client/src/main/java/org/apache/pulsar/client/impl/BinaryProtoLookupService.java
@@ -46,6 +46,7 @@ import org.apache.pulsar.common.naming.TopicName;
 import org.apache.pulsar.common.partition.PartitionedTopicMetadata;
 import org.apache.pulsar.common.protocol.schema.BytesSchemaVersion;
 import org.apache.pulsar.common.schema.SchemaInfo;
+import org.apache.pulsar.common.util.FutureUtil;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -136,19 +137,22 @@ public class BinaryProtoLookupService implements LookupService {
                         // (2) redirect to given address if response is: redirect
                         if (r.redirect) {
                             findBroker(responseBrokerAddress, r.authoritative, topicName, redirectCount + 1)
-                                .thenAccept(addressFuture::complete).exceptionally((lookupException) -> {
-                                // lookup failed
-                                if (redirectCount > 0) {
-                                    if (log.isDebugEnabled()) {
-                                        log.debug("[{}] lookup redirection failed ({}) : {}", topicName.toString(),
-                                                redirectCount, lookupException.getMessage());
-                                    }
-                                } else {
-                                    log.warn("[{}] lookup failed : {}", topicName.toString(),
-                                            lookupException.getMessage(), lookupException);
-                                }
-                                addressFuture.completeExceptionally(lookupException);
-                                return null;
+                                    .thenAccept(addressFuture::complete)
+                                    .exceptionally((lookupException) -> {
+                                        Throwable cause = FutureUtil.unwrapCompletionException(lookupException);
+                                        // lookup failed
+                                        if (redirectCount > 0) {
+                                            if (log.isDebugEnabled()) {
+                                                log.debug("[{}] lookup redirection failed ({}) : {}", topicName,
+                                                        redirectCount, cause.getMessage());
+                                            }
+                                        } else {
+                                            log.warn("[{}] lookup failed : {}", topicName,
+                                                    cause.getMessage(), cause);
+                                        }
+                                        addressFuture.completeExceptionally(cause);
+                                        return null;
+
                             });
                         } else {
                             // (3) received correct broker to connect
@@ -171,7 +175,7 @@ public class BinaryProtoLookupService implements LookupService {
                 client.getCnxPool().releaseConnection(clientCnx);
             });
         }).exceptionally(connectionException -> {
-            addressFuture.completeExceptionally(connectionException);
+            addressFuture.completeExceptionally(FutureUtil.unwrapCompletionException(connectionException));
             return null;
         });
         return addressFuture;
@@ -203,7 +207,7 @@ public class BinaryProtoLookupService implements LookupService {
                 client.getCnxPool().releaseConnection(clientCnx);
             });
         }).exceptionally(connectionException -> {
-            partitionFuture.completeExceptionally(connectionException);
+            partitionFuture.completeExceptionally(FutureUtil.unwrapCompletionException(connectionException));
             return null;
         });
 
@@ -239,7 +243,7 @@ public class BinaryProtoLookupService implements LookupService {
                 client.getCnxPool().releaseConnection(clientCnx);
             });
         }).exceptionally(ex -> {
-            schemaFuture.completeExceptionally(ex);
+            schemaFuture.completeExceptionally(FutureUtil.unwrapCompletionException(ex));
             return null;
         });
 
diff --git a/pulsar-client/src/main/java/org/apache/pulsar/client/impl/HttpLookupService.java b/pulsar-client/src/main/java/org/apache/pulsar/client/impl/HttpLookupService.java
index 72326c3db1f..cde8ed30604 100644
--- a/pulsar-client/src/main/java/org/apache/pulsar/client/impl/HttpLookupService.java
+++ b/pulsar-client/src/main/java/org/apache/pulsar/client/impl/HttpLookupService.java
@@ -142,10 +142,11 @@ public class HttpLookupService implements LookupService {
                         result.add(filtered);
                     }
                 });
-                future.complete(result);})
-            .exceptionally(ex -> {
-                log.warn("Failed to getTopicsUnderNamespace namespace {} {}.", namespace, ex.getMessage());
-                future.completeExceptionally(ex);
+                future.complete(result);
+            }).exceptionally(ex -> {
+                Throwable cause = FutureUtil.unwrapCompletionException(ex);
+                log.warn("Failed to getTopicsUnderNamespace namespace {} {}.", namespace, cause.getMessage());
+                future.completeExceptionally(cause);
                 return null;
             });
         return future;
@@ -188,14 +189,15 @@ public class HttpLookupService implements LookupService {
                 future.complete(Optional.of(SchemaInfoUtil.newSchemaInfo(schemaName, response)));
             }
         }).exceptionally(ex -> {
-            if (ex.getCause() instanceof NotFoundException) {
+            Throwable cause = FutureUtil.unwrapCompletionException(ex);
+            if (cause instanceof NotFoundException) {
                 future.complete(Optional.empty());
             } else {
                 log.warn("Failed to get schema for topic {} version {}",
                         topicName,
                         version != null ? Base64.getEncoder().encodeToString(version) : null,
-                        ex.getCause());
-                future.completeExceptionally(ex);
+                        cause);
+                future.completeExceptionally(cause);
             }
             return null;
         });


[pulsar] 03/03: [fix][broker] add return for PersistentMessageExpiryMonitor#findEntryFailed

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

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

commit 85e65aa93d9ef03848fec7f7bb2536d43aec4565
Author: HuangZeGui <hz...@126.com>
AuthorDate: Mon Oct 10 17:33:14 2022 +0800

    [fix][broker] add return for PersistentMessageExpiryMonitor#findEntryFailed
    
    (cherry picked from commit 9281bbdb92531e06d0baa8e05250928c9d530440)
---
 .../pulsar/broker/service/persistent/PersistentMessageExpiryMonitor.java | 1 +
 1 file changed, 1 insertion(+)

diff --git a/pulsar-broker/src/main/java/org/apache/pulsar/broker/service/persistent/PersistentMessageExpiryMonitor.java b/pulsar-broker/src/main/java/org/apache/pulsar/broker/service/persistent/PersistentMessageExpiryMonitor.java
index 32cff81a64f..911e2a4bebf 100644
--- a/pulsar-broker/src/main/java/org/apache/pulsar/broker/service/persistent/PersistentMessageExpiryMonitor.java
+++ b/pulsar-broker/src/main/java/org/apache/pulsar/broker/service/persistent/PersistentMessageExpiryMonitor.java
@@ -214,6 +214,7 @@ public class PersistentMessageExpiryMonitor implements FindEntryCallback {
             } else {
                 findEntryComplete(failedReadPosition.get(), ctx);
             }
+            return;
         }
         expirationCheckInProgress = FALSE;
         updateRates();