Skip to content

[fix][broker] Fix namespace backlog quota check with retention. - #17706

Merged
codelipenghui merged 3 commits into
apache:masterfrom
Jason918:fix_17697
Sep 19, 2022
Merged

codelipenghui merged 3 commits into
apache:masterfrom
Jason918:fix_17697

Conversation

@Jason918

@Jason918 Jason918 commented Sep 18, 2022 •

Copy link
Copy Markdown
Contributor

Fixes #17707

Motivation

  1. Fix the case mentioned in Why pulsar retention quota must exceed configured backlog quota #17707
  2. Fix checkBacklogQuota fails when both retention.size and backlogQuota.size is -1. Same as time check.

Verifying this change

  • Make sure that the change passes the CI checks.

This change added tests and can be verified as follows:

  • testRetentionAndBacklogQuotaCheck

Does this pull request potentially affect one of the following parts:

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 binary protocol
  • The REST endpoints
  • The admin CLI options
  • Anything that affects deployment

Documentation

  • doc-required
    (Your PR needs to update docs and you will update later)

  • doc-not-needed
    bug

  • doc
    (Your PR contains doc changes)

  • doc-complete
    (Docs have been already added)

@Jason918 Jason918 added type/bug The PR fixed a bug or issue reported a bug area/broker labels Sep 18, 2022
@Jason918 Jason918 self-assigned this Sep 18, 2022
@github-actions github-actions Bot added the doc-not-needed Your PR changes do not impact docs label Sep 18, 2022

@michaeljmarshall michaeljmarshall left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Thanks @Jason918!

JiangHaiting added 2 commits September 18, 2022 16:20
@codelipenghui codelipenghui added this to the 2.12.0 milestone Sep 19, 2022
protected boolean checkBacklogQuota(BacklogQuota quota, RetentionPolicies retention) {
if (retention == null || retention.getRetentionSizeInMB() <= 0 || retention.getRetentionTimeInMinutes() <= 0) {
if (retention == null
|| (retention.getRetentionSizeInMB() <= 0 && retention.getRetentionTimeInMinutes() <= 0)) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like the added test can't cover this branch?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@codelipenghui As mentioned in the issue. The test in L3417 won't fail before this change.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And the case of (retention.getRetentionSizeInMB() <= 0 && retention.getRetentionTimeInMinutes() <= 0) is the default setting, it's covered by previous unit tests.

@codelipenghui
codelipenghui merged commit c6967cd into apache:master Sep 19, 2022
nicoloboschi pushed a commit to datastax/pulsar that referenced this pull request Sep 28, 2022
congbobo184 pushed a commit that referenced this pull request Nov 10, 2022
@congbobo184 congbobo184 added the cherry-picked/branch-2.9 Archived: 2.9 is end of life label Nov 10, 2022
congbobo184 pushed a commit that referenced this pull request Nov 30, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Why pulsar retention quota must exceed configured backlog quota

5 participants