Skip to content

Commit b1019ce

Browse files
authored
[improve][broker] Enhance logging for adding schema failures in ServerCnx (#25048)
1 parent f101811 commit b1019ce

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
@@ -100,6 +100,7 @@
100100
import org.apache.pulsar.broker.service.persistent.PersistentTopic;
101101
import org.apache.pulsar.broker.service.schema.SchemaRegistryService;
102102
import org.apache.pulsar.broker.service.schema.exceptions.IncompatibleSchemaException;
103+
import org.apache.pulsar.broker.service.schema.exceptions.InvalidSchemaDataException;
103104
import org.apache.pulsar.broker.topiclistlimit.TopicListMemoryLimiter;
104105
import org.apache.pulsar.broker.topiclistlimit.TopicListSizeResultCache;
105106
import org.apache.pulsar.broker.web.RestException;
@@ -1730,11 +1731,17 @@ protected void handleProducer(final CommandProducer cmdProducer) {
17301731
BrokerServiceException.getClientErrorCode(exception),
17311732
message);
17321733
}
1734+
17331735
var cause = FutureUtil.unwrapCompletionException(exception);
1734-
if (!(cause instanceof IncompatibleSchemaException)) {
1736+
if (cause instanceof IncompatibleSchemaException) {
1737+
// ignore it
1738+
} else if (cause instanceof InvalidSchemaDataException) {
1739+
log.warn("Try add schema failed due to invalid schema data, "
1740+
+ "remote address {}, topic {}, producerId {}",
1741+
remoteAddress, topicName, producerId);
1742+
} else {
17351743
log.error("Try add schema failed, remote address {}, topic {}, producerId {}",
1736-
remoteAddress,
1737-
topicName, producerId, exception);
1744+
remoteAddress, topicName, producerId, exception);
17381745
}
17391746
producers.remove(producerId, producerFuture);
17401747
return null;

0 commit comments

Comments
 (0)