Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[fix][broker] Fix bug causing loss of migrated information when setting other localPolicies in namespace #23764

Merged
merged 1 commit into from
Dec 20, 2024

Conversation

hrzzzz
Copy link
Contributor

@hrzzzz hrzzzz commented Dec 20, 2024

Motivation

#21367 introduced the migrated field in localPolicies to indicate whether the topics under a namespace have been migrated in the blue-green cluster migration feature.

In #9598, it is specified that when updating the field content of localPolicies, a new object needs to be created instead of updating the original object.

After the addition of the migrated field in #21367, there has been no synchronization of modifications in other places that update localPolicies. This could lead to the loss of the migrated content during other operations on localPolicies, such as setting the namespaceAntiAffinityGroup, etc.

Modifications

  1. Synchronize the migrated content in the places where localPolicies are updated
  2. When updating the migrated field of localPolicies, do not modify the original object

Verifying this change

  • Make sure that the change passes the CI checks.

This change added tests and can be verified as follows:

  • Added test in: org.apache.pulsar.broker.admin.NamespacesTest#testMigratedInfoIsNotLostDuringOtherLocalPoliciesUpdate

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

Documentation

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

Matching PR in forked repository

PR in forked repository: hrzzzz#13

@github-actions github-actions bot added the doc-not-needed Your PR changes do not impact docs label Dec 20, 2024
Copy link
Member

@lhotari lhotari left a comment

Choose a reason for hiding this comment

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

LGTM, good work @hrzzzz

@hrzzzz
Copy link
Contributor Author

hrzzzz commented Dec 20, 2024

/pulsarbot rerun-failure-checks

@codecov-commenter
Copy link

codecov-commenter commented Dec 20, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 74.26%. Comparing base (bbc6224) to head (bd19ba4).
Report is 809 commits behind head on master.

Additional details and impacted files

Impacted file tree graph

@@             Coverage Diff              @@
##             master   #23764      +/-   ##
============================================
+ Coverage     73.57%   74.26%   +0.68%     
+ Complexity    32624    32098     -526     
============================================
  Files          1877     1838      -39     
  Lines        139502   143058    +3556     
  Branches      15299    16232     +933     
============================================
+ Hits         102638   106239    +3601     
+ Misses        28908    28426     -482     
- Partials       7956     8393     +437     
Flag Coverage Δ
inttests 26.68% <50.00%> (+2.09%) ⬆️
systests 23.69% <50.00%> (-0.64%) ⬇️
unittests 73.63% <100.00%> (+0.78%) ⬆️

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

Files with missing lines Coverage Δ
...pache/pulsar/broker/admin/impl/NamespacesBase.java 76.09% <100.00%> (+3.01%) ⬆️
.../apache/pulsar/common/naming/NamespaceBundles.java 80.00% <100.00%> (+0.25%) ⬆️
...che/pulsar/common/policies/data/LocalPolicies.java 100.00% <100.00%> (+8.33%) ⬆️

... and 1003 files with indirect coverage changes

@lhotari lhotari merged commit bbe2cab into apache:master Dec 20, 2024
60 checks passed
lhotari pushed a commit that referenced this pull request Dec 21, 2024
…ng other localPolicies in namespace (#23764)

Co-authored-by: ruihongzhou <[email protected]>
(cherry picked from commit bbe2cab)
lhotari pushed a commit that referenced this pull request Dec 21, 2024
…ng other localPolicies in namespace (#23764)

Co-authored-by: ruihongzhou <[email protected]>
(cherry picked from commit bbe2cab)
@hrzzzz hrzzzz deleted the fix-local-policies branch December 23, 2024 06:40
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.

3 participants