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


The following commit(s) were added to refs/heads/branch-4.0 by this push:
     new 3f0a18f0824 [improve][broker] Enhance logging for adding schema 
failures in ServerCnx (#25048)
3f0a18f0824 is described below

commit 3f0a18f08247298575387b461305e032de3f006f
Author: Cong Zhao <[email protected]>
AuthorDate: Mon Jan 5 17:04:12 2026 +0800

    [improve][broker] Enhance logging for adding schema failures in ServerCnx 
(#25048)
    
    (cherry picked from commit b1019ce54dd3b81cdb2804a5f37c862022132034)
---
 .../java/org/apache/pulsar/broker/service/ServerCnx.java    | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)

diff --git 
a/pulsar-broker/src/main/java/org/apache/pulsar/broker/service/ServerCnx.java 
b/pulsar-broker/src/main/java/org/apache/pulsar/broker/service/ServerCnx.java
index f8d9ac8d0e5..991fc8d536c 100644
--- 
a/pulsar-broker/src/main/java/org/apache/pulsar/broker/service/ServerCnx.java
+++ 
b/pulsar-broker/src/main/java/org/apache/pulsar/broker/service/ServerCnx.java
@@ -101,6 +101,7 @@ import 
org.apache.pulsar.broker.service.persistent.PersistentSubscription;
 import org.apache.pulsar.broker.service.persistent.PersistentTopic;
 import org.apache.pulsar.broker.service.schema.SchemaRegistryService;
 import 
org.apache.pulsar.broker.service.schema.exceptions.IncompatibleSchemaException;
+import 
org.apache.pulsar.broker.service.schema.exceptions.InvalidSchemaDataException;
 import org.apache.pulsar.broker.topiclistlimit.TopicListMemoryLimiter;
 import org.apache.pulsar.broker.topiclistlimit.TopicListSizeResultCache;
 import org.apache.pulsar.broker.web.RestException;
@@ -1728,11 +1729,17 @@ public class ServerCnx extends PulsarHandler implements 
TransportCnx {
                                     
BrokerServiceException.getClientErrorCode(exception),
                                     message);
                         }
+
                         var cause = 
FutureUtil.unwrapCompletionException(exception);
-                        if (!(cause instanceof IncompatibleSchemaException)) {
+                        if (cause instanceof IncompatibleSchemaException) {
+                            // ignore it
+                        } else if (cause instanceof 
InvalidSchemaDataException) {
+                            log.warn("Try add schema failed due to invalid 
schema data, "
+                                    + "remote address {}, topic {}, producerId 
{}",
+                                remoteAddress, topicName, producerId);
+                        } else {
                             log.error("Try add schema failed, remote address 
{}, topic {}, producerId {}",
-                                    remoteAddress,
-                                    topicName, producerId, exception);
+                            remoteAddress, topicName, producerId, exception);
                         }
                         producers.remove(producerId, producerFuture);
                         return null;

Reply via email to