Skip to content

Commit 3f0a18f

Browse files
committed
[improve][broker] Enhance logging for adding schema failures in ServerCnx (#25048)
(cherry picked from commit b1019ce)
1 parent 9bafb84 commit 3f0a18f

File tree

1 file changed

+10
-3
lines changed
  • pulsar-broker/src/main/java/org/apache/pulsar/broker/service

1 file changed

+10
-3
lines changed

pulsar-broker/src/main/java/org/apache/pulsar/broker/service/ServerCnx.java

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,7 @@
101101
import org.apache.pulsar.broker.service.persistent.PersistentTopic;
102102
import org.apache.pulsar.broker.service.schema.SchemaRegistryService;
103103
import org.apache.pulsar.broker.service.schema.exceptions.IncompatibleSchemaException;
104+
import org.apache.pulsar.broker.service.schema.exceptions.InvalidSchemaDataException;
104105
import org.apache.pulsar.broker.topiclistlimit.TopicListMemoryLimiter;
105106
import org.apache.pulsar.broker.topiclistlimit.TopicListSizeResultCache;
106107
import org.apache.pulsar.broker.web.RestException;
@@ -1728,11 +1729,17 @@ protected void handleProducer(final CommandProducer cmdProducer) {
17281729
BrokerServiceException.getClientErrorCode(exception),
17291730
message);
17301731
}
1732+
17311733
var cause = FutureUtil.unwrapCompletionException(exception);
1732-
if (!(cause instanceof IncompatibleSchemaException)) {
1734+
if (cause instanceof IncompatibleSchemaException) {
1735+
// ignore it
1736+
} else if (cause instanceof InvalidSchemaDataException) {
1737+
log.warn("Try add schema failed due to invalid schema data, "
1738+
+ "remote address {}, topic {}, producerId {}",
1739+
remoteAddress, topicName, producerId);
1740+
} else {
17331741
log.error("Try add schema failed, remote address {}, topic {}, producerId {}",
1734-
remoteAddress,
1735-
topicName, producerId, exception);
1742+
remoteAddress, topicName, producerId, exception);
17361743
}
17371744
producers.remove(producerId, producerFuture);
17381745
return null;

0 commit comments

Comments
 (0)