Skip to content

Change broker exception from TopicBacklogQuotaExceededException to TopicBlockQuotaExceededException #25168

@geniusjoe

Description

@geniusjoe

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.

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!

Metadata

Metadata

Assignees

No one assigned

    Labels

    type/enhancementThe enhancements for the existing features or docs. e.g. reduce memory usage of the delayed messages

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions