Skip to content

[fix][cli] Fix set-retention with >2GB size value for topic policy#23689

Merged
lhotari merged 1 commit intoapache:masterfrom
lhotari:lh-fix-set-retention-topic-policy
Dec 7, 2024
Merged

[fix][cli] Fix set-retention with >2GB size value for topic policy#23689
lhotari merged 1 commit intoapache:masterfrom
lhotari:lh-fix-set-retention-topic-policy

Conversation

@lhotari
Copy link
Copy Markdown
Member

@lhotari lhotari commented Dec 6, 2024

Motivation

Fixes a similar issue as #22150, for pulsar-admin topics set-retention and pulsar-admin topicPolicies set-retention commands. Related to #23688. This adds a test to #23688 changes.

The impact of this bug is that when the value overflows when it's over 2GB. The effective value becomes negative or 0, which disables retention. There won't be a failure. For example, with the parameter -s 3G, the value becomes -1024. With any value more than 4GB, the value becomes 0.

Modifications

Documentation

  • doc
  • doc-required
  • doc-not-needed
  • doc-complete

@lhotari lhotari force-pushed the lh-fix-set-retention-topic-policy branch from 84497c7 to 4ce3296 Compare December 6, 2024 23:00
@lhotari lhotari requested a review from poorbarcode December 6, 2024 23:01
@codecov-commenter
Copy link
Copy Markdown

codecov-commenter commented Dec 7, 2024

Codecov Report

Attention: Patch coverage is 50.00000% with 2 lines in your changes missing coverage. Please review.

Project coverage is 74.41%. Comparing base (bbc6224) to head (4ce3296).
Report is 780 commits behind head on master.

Files with missing lines Patch % Lines
.../org/apache/pulsar/admin/cli/CmdTopicPolicies.java 50.00% 0 Missing and 1 partial ⚠️
...in/java/org/apache/pulsar/admin/cli/CmdTopics.java 50.00% 0 Missing and 1 partial ⚠️
Additional details and impacted files

Impacted file tree graph

@@             Coverage Diff              @@
##             master   #23689      +/-   ##
============================================
+ Coverage     73.57%   74.41%   +0.84%     
- Complexity    32624    35082    +2458     
============================================
  Files          1877     1945      +68     
  Lines        139502   147448    +7946     
  Branches      15299    16270     +971     
============================================
+ Hits         102638   109724    +7086     
- Misses        28908    29242     +334     
- Partials       7956     8482     +526     
Flag Coverage Δ
inttests 27.42% <0.00%> (+2.84%) ⬆️
systests 24.40% <0.00%> (+0.07%) ⬆️
unittests 73.79% <50.00%> (+0.94%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
.../org/apache/pulsar/admin/cli/CmdTopicPolicies.java 89.61% <50.00%> (ø)
...in/java/org/apache/pulsar/admin/cli/CmdTopics.java 80.61% <50.00%> (-0.57%) ⬇️

... and 664 files with indirect coverage changes

Copy link
Copy Markdown
Contributor

@liangyepianzhou liangyepianzhou left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Copy Markdown
Member

@dao-jun dao-jun left a comment

Choose a reason for hiding this comment

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

lgtm

@poorbarcode
Copy link
Copy Markdown
Contributor

@lhotari

If do not cherry-pick into branch-3.0, there is a downgrade compatibility issue:

  • upgrade to 4.0.x
  • Set a larger value for the policy.
  • downgrade to 3.0.x, the value will be transferred to a negative value,

@lhotari
Copy link
Copy Markdown
Member Author

lhotari commented Dec 20, 2024

@lhotari

If do not cherry-pick into branch-3.0, there is a downgrade compatibility issue:

  • upgrade to 4.0.x
  • Set a larger value for the policy.
  • downgrade to 3.0.x, the value will be transferred to a negative value,

@poorbarcode I don't think that this applies to 3.0.x since the regression was introduced in changes made in #20782 (and possibly #22209) which aren't part of 3.0.x. The issue #22138 was reported to be a regression in 3.2.0 . When we fixed this issue, we missed fixing it for topic policies and only fixed the namespace policies level.

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.

6 participants