-
Notifications
You must be signed in to change notification settings - Fork 3.7k
Description
Search before reporting
- I searched in the issues and found nothing similar.
Motivation
Based on the code, there appears to be a typo previously: when the server throws ProducerBacklogQuotaExceededError, the exception actually generated in PulsarApi.proto is ProducerBlockedQuotaExceededException.
This makes it difficult for developers to locate key information from the server-side code when the client receives the related exception. To keep consistency between server and client error reporting, maybe we should update the server-side exception to TopicBlockQuotaExceededException as well.
pulsar/pulsar-broker/src/main/java/org/apache/pulsar/broker/service/ServerCnx.java
Line 1804 in 85625e0
| if (cause instanceof BrokerServiceException.TopicBacklogQuotaExceededException) { |
if (cause instanceof BrokerServiceException.TopicBacklogQuotaExceededException) {
BrokerServiceException.TopicBacklogQuotaExceededException tbqe =
(BrokerServiceException.TopicBacklogQuotaExceededException) cause;
IllegalStateException illegalStateException = new IllegalStateException(tbqe);
BacklogQuota.RetentionPolicy retentionPolicy = tbqe.getRetentionPolicy();
if (producerFuture.completeExceptionally(illegalStateException)) {
if (retentionPolicy == BacklogQuota.RetentionPolicy.producer_request_hold) {
commandSender.sendErrorResponse(requestId,
ServerError.ProducerBlockedQuotaExceededError,
illegalStateException.getMessage());
} else if (retentionPolicy == BacklogQuota.RetentionPolicy.producer_exception) {
commandSender.sendErrorResponse(requestId,
ServerError.ProducerBlockedQuotaExceededException,
illegalStateException.getMessage());Solution
Update the server-side exception to TopicBlockQuotaExceededException as well.
Alternatives
We could also completely resolve this issue by changing both the pb and client exceptions to ProducerBacklogQuotaExceededError. However, due to compatibility considerations between lower versions of the client and pb, this modification would have a significant impact on the client, potentially causing incompatibility between older client versions and newer broker versions.
Anything else?
No response
Are you willing to submit a PR?
- I'm willing to submit a PR!