You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by "coderzc (via GitHub)" <gi...@apache.org> on 2025/12/09 03:43:35 UTC
[PR] [improve][broker] Enhance logging for adding schema failures in ServerCnx [pulsar]
coderzc opened a new pull request, #25048:
URL: https://github.com/apache/pulsar/pull/25048
### Motivation
Since broker sent ErrorResponse to client when adding schema failed, so broker side only need to print warn log to help to troubleshoot the problem.
### Modifications
The log level is changed from `error` to `warn`, and the conditional check for `IncompatibleSchemaException` is removed, so all failures are now logged as warnings.
### Verifying this change
- [x] Make sure that the change passes the CI checks.
*(Please pick either of the following options)*
This change is a trivial rework / code cleanup without any test coverage.
*(or)*
This change is already covered by existing tests, such as *(please describe tests)*.
*(or)*
This change added tests and can be verified as follows:
*(example:)*
- *Added integration tests for end-to-end deployment with large payloads (10MB)*
- *Extended integration test for recovery after broker failure*
### Does this pull request potentially affect one of the following parts:
<!-- DO NOT REMOVE THIS SECTION. CHECK THE PROPER BOX ONLY. -->
*If the box was checked, please highlight the changes*
- [ ] Dependencies (add or upgrade a dependency)
- [ ] The public API
- [ ] The schema
- [ ] The default values of configurations
- [ ] The threading model
- [ ] The binary protocol
- [ ] The REST endpoints
- [ ] The admin CLI options
- [ ] The metrics
- [ ] Anything that affects deployment
### Documentation
<!-- DO NOT REMOVE THIS SECTION. CHECK THE PROPER BOX ONLY. -->
- [ ] `doc` <!-- Your PR contains doc changes. -->
- [ ] `doc-required` <!-- Your PR changes impact docs and you will update later -->
- [x] `doc-not-needed` <!-- Your PR changes do not impact docs -->
- [ ] `doc-complete` <!-- Docs have been already added -->
### Matching PR in forked repository
PR in forked repository: <!-- ENTER URL HERE -->
<!--
After opening this PR, the build in apache/pulsar will fail and instructions will
be provided for opening a PR in the PR author's forked repository.
apache/pulsar pull requests should be first tested in your own fork since the
apache/pulsar CI based on GitHub Actions has constrained resources and quota.
GitHub Actions provides separate quota for pull requests that are executed in
a forked repository.
The tests will be run in the forked repository until all PR review comments have
been handled, the tests pass and the PR is approved by a reviewer.
-->
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@pulsar.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [improve][broker] Enhance logging for adding schema failures in ServerCnx [pulsar]
Posted by "coderzc (via GitHub)" <gi...@apache.org>.
coderzc merged PR #25048:
URL: https://github.com/apache/pulsar/pull/25048
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@pulsar.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [improve][broker] Enhance logging for adding schema failures in ServerCnx [pulsar]
Posted by "coderzc (via GitHub)" <gi...@apache.org>.
coderzc commented on code in PR #25048:
URL: https://github.com/apache/pulsar/pull/25048#discussion_r2602370609
##########
pulsar-broker/src/main/java/org/apache/pulsar/broker/service/ServerCnx.java:
##########
@@ -1730,12 +1730,8 @@ protected void handleProducer(final CommandProducer cmdProducer) {
BrokerServiceException.getClientErrorCode(exception),
message);
}
- var cause = FutureUtil.unwrapCompletionException(exception);
- if (!(cause instanceof IncompatibleSchemaException)) {
- log.error("Try add schema failed, remote address {}, topic {}, producerId {}",
- remoteAddress,
- topicName, producerId, exception);
- }
+ log.warn("Try add schema failed, remote address {}, topic {}, producerId {}",
Review Comment:
If `IncompatibleSchemaException` can be ignored, then what about `InvalidSchemaDataException`? Does it also need to be ignored?
e.g
```java
org.apache.pulsar.broker.service.schema.exceptions.InvalidSchemaDataException: Invalid schema definition data for PROTOBUF schema
at org.apache.pulsar.broker.service.schema.validator.StructSchemaDataValidator.throwInvalidSchemaDataException(StructSchemaDataValidator.java:98)
at org.apache.pulsar.broker.service.schema.validator.StructSchemaDataValidator.validate(StructSchemaDataValidator.java:69)
at org.apache.pulsar.broker.service.schema.validator.SchemaDataValidator.validateSchemaData(SchemaDataValidator.java:46)
at org.apache.pulsar.broker.service.schema.validator.SchemaRegistryServiceWithSchemaDataValidator.putSchemaIfAbsent(SchemaRegistryServiceWithSchemaDataValidator.java:92)
at org.apache.pulsar.broker.service.AbstractTopic.addSchema(AbstractTopic.java:729)
at org.apache.pulsar.broker.service.ServerCnx.tryAddSchema(ServerCnx.java:3185)
at org.apache.pulsar.broker.service.ServerCnx.lambda$handleProducer$32(ServerCnx.java:1721)
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@pulsar.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [improve][broker] Enhance logging for adding schema failures in ServerCnx [pulsar]
Posted by "coderzc (via GitHub)" <gi...@apache.org>.
coderzc commented on code in PR #25048:
URL: https://github.com/apache/pulsar/pull/25048#discussion_r2602370609
##########
pulsar-broker/src/main/java/org/apache/pulsar/broker/service/ServerCnx.java:
##########
@@ -1730,12 +1730,8 @@ protected void handleProducer(final CommandProducer cmdProducer) {
BrokerServiceException.getClientErrorCode(exception),
message);
}
- var cause = FutureUtil.unwrapCompletionException(exception);
- if (!(cause instanceof IncompatibleSchemaException)) {
- log.error("Try add schema failed, remote address {}, topic {}, producerId {}",
- remoteAddress,
- topicName, producerId, exception);
- }
+ log.warn("Try add schema failed, remote address {}, topic {}, producerId {}",
Review Comment:
If `IncompatibleSchemaException` should be ignored, then what about `InvalidSchemaDataException`? Does it also need to be ignored?
e.g
```java
org.apache.pulsar.broker.service.schema.exceptions.InvalidSchemaDataException: Invalid schema definition data for PROTOBUF schema
at org.apache.pulsar.broker.service.schema.validator.StructSchemaDataValidator.throwInvalidSchemaDataException(StructSchemaDataValidator.java:98)
at org.apache.pulsar.broker.service.schema.validator.StructSchemaDataValidator.validate(StructSchemaDataValidator.java:69)
at org.apache.pulsar.broker.service.schema.validator.SchemaDataValidator.validateSchemaData(SchemaDataValidator.java:46)
at org.apache.pulsar.broker.service.schema.validator.SchemaRegistryServiceWithSchemaDataValidator.putSchemaIfAbsent(SchemaRegistryServiceWithSchemaDataValidator.java:92)
at org.apache.pulsar.broker.service.AbstractTopic.addSchema(AbstractTopic.java:729)
at org.apache.pulsar.broker.service.ServerCnx.tryAddSchema(ServerCnx.java:3185)
at org.apache.pulsar.broker.service.ServerCnx.lambda$handleProducer$32(ServerCnx.java:1721)
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@pulsar.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [improve][broker] Enhance logging for adding schema failures in ServerCnx [pulsar]
Posted by "poorbarcode (via GitHub)" <gi...@apache.org>.
poorbarcode commented on code in PR #25048:
URL: https://github.com/apache/pulsar/pull/25048#discussion_r2601878441
##########
pulsar-broker/src/main/java/org/apache/pulsar/broker/service/ServerCnx.java:
##########
@@ -1730,12 +1730,8 @@ protected void handleProducer(final CommandProducer cmdProducer) {
BrokerServiceException.getClientErrorCode(exception),
message);
}
- var cause = FutureUtil.unwrapCompletionException(exception);
- if (!(cause instanceof IncompatibleSchemaException)) {
- log.error("Try add schema failed, remote address {}, topic {}, producerId {}",
- remoteAddress,
- topicName, producerId, exception);
- }
+ log.warn("Try add schema failed, remote address {}, topic {}, producerId {}",
Review Comment:
If the client-side makes a mistake, which registrers a incompatible schema, we should not print any warn log for it. In other words, `IncompatibleSchemaException` should be ignored
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@pulsar.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [improve][broker] Enhance logging for adding schema failures in ServerCnx [pulsar]
Posted by "coderzc (via GitHub)" <gi...@apache.org>.
coderzc commented on code in PR #25048:
URL: https://github.com/apache/pulsar/pull/25048#discussion_r2626168601
##########
pulsar-broker/src/main/java/org/apache/pulsar/broker/service/ServerCnx.java:
##########
@@ -1730,12 +1730,8 @@ protected void handleProducer(final CommandProducer cmdProducer) {
BrokerServiceException.getClientErrorCode(exception),
message);
}
- var cause = FutureUtil.unwrapCompletionException(exception);
- if (!(cause instanceof IncompatibleSchemaException)) {
- log.error("Try add schema failed, remote address {}, topic {}, producerId {}",
- remoteAddress,
- topicName, producerId, exception);
- }
+ log.warn("Try add schema failed, remote address {}, topic {}, producerId {}",
Review Comment:
Ignored InvalidSchemaDataException @poorbarcode
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@pulsar.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [improve][broker] Enhance logging for adding schema failures in ServerCnx [pulsar]
Posted by "coderzc (via GitHub)" <gi...@apache.org>.
coderzc commented on code in PR #25048:
URL: https://github.com/apache/pulsar/pull/25048#discussion_r2602370609
##########
pulsar-broker/src/main/java/org/apache/pulsar/broker/service/ServerCnx.java:
##########
@@ -1730,12 +1730,8 @@ protected void handleProducer(final CommandProducer cmdProducer) {
BrokerServiceException.getClientErrorCode(exception),
message);
}
- var cause = FutureUtil.unwrapCompletionException(exception);
- if (!(cause instanceof IncompatibleSchemaException)) {
- log.error("Try add schema failed, remote address {}, topic {}, producerId {}",
- remoteAddress,
- topicName, producerId, exception);
- }
+ log.warn("Try add schema failed, remote address {}, topic {}, producerId {}",
Review Comment:
If `IncompatibleSchemaException` can be ignored, then what about `InvalidSchemaDataException`? Does it also need to be ignored?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@pulsar.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [improve][broker] Enhance logging for adding schema failures in ServerCnx [pulsar]
Posted by "poorbarcode (via GitHub)" <gi...@apache.org>.
poorbarcode commented on code in PR #25048:
URL: https://github.com/apache/pulsar/pull/25048#discussion_r2660130205
##########
pulsar-broker/src/main/java/org/apache/pulsar/broker/service/ServerCnx.java:
##########
@@ -1730,12 +1730,8 @@ protected void handleProducer(final CommandProducer cmdProducer) {
BrokerServiceException.getClientErrorCode(exception),
message);
}
- var cause = FutureUtil.unwrapCompletionException(exception);
- if (!(cause instanceof IncompatibleSchemaException)) {
- log.error("Try add schema failed, remote address {}, topic {}, producerId {}",
- remoteAddress,
- topicName, producerId, exception);
- }
+ log.warn("Try add schema failed, remote address {}, topic {}, producerId {}",
Review Comment:
```java
if (!(cause instanceof IncompatibleSchemaException)) {
log.error("Try add schema failed, remote address {}, topic {}, producerId {}",
remoteAddress,
topicName, producerId, exception);
log.warn("Try add schema failed, remote address {}, topic {}, producerId {}",
remoteAddress, topicName, producerId, exception);
}
```
The variable `cause` may be an error that unexpected, such as failed to write BK/ZK, could we modify the log level for the certain error that we knew only
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@pulsar.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [improve][broker] Enhance logging for adding schema failures in ServerCnx [pulsar]
Posted by "coderzc (via GitHub)" <gi...@apache.org>.
coderzc commented on code in PR #25048:
URL: https://github.com/apache/pulsar/pull/25048#discussion_r2626168601
##########
pulsar-broker/src/main/java/org/apache/pulsar/broker/service/ServerCnx.java:
##########
@@ -1730,12 +1730,8 @@ protected void handleProducer(final CommandProducer cmdProducer) {
BrokerServiceException.getClientErrorCode(exception),
message);
}
- var cause = FutureUtil.unwrapCompletionException(exception);
- if (!(cause instanceof IncompatibleSchemaException)) {
- log.error("Try add schema failed, remote address {}, topic {}, producerId {}",
- remoteAddress,
- topicName, producerId, exception);
- }
+ log.warn("Try add schema failed, remote address {}, topic {}, producerId {}",
Review Comment:
Ignored InvalidSchemaDataException @poorbarcode
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@pulsar.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [improve][broker] Enhance logging for adding schema failures in ServerCnx [pulsar]
Posted by "coderzc (via GitHub)" <gi...@apache.org>.
coderzc closed pull request #25048: [improve][broker] Enhance logging for adding schema failures in ServerCnx
URL: https://github.com/apache/pulsar/pull/25048
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@pulsar.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org