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 redirect loop when using ExtensibleLoadManager and list in bundle admin API #20528

Merged

Conversation

Demogorgon314
Copy link
Member

PIP: #16691

Motivation

When using ExtensibleLoadManager and list in bundle admin API,
it will redirect forever because isServiceUnitOwned method is checking the ownershipCache as the ownership storage, however, when using ExtensibleLoadManager, it stored the ownership to table view.

Modifications

  • Call isServiceUnitOwnedAsync when using isServiceUnitOwned .
  • Add unit test to cover this case.

Documentation

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

@Demogorgon314 Demogorgon314 added type/bug The PR fixed a bug or issue reported a bug area/broker release/3.0.1 labels Jun 7, 2023
@Demogorgon314 Demogorgon314 self-assigned this Jun 7, 2023
@github-actions github-actions bot added the doc-not-needed Your PR changes do not impact docs label Jun 7, 2023
Copy link
Contributor

@eolivelli eolivelli left a comment

Choose a reason for hiding this comment

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

+1

@@ -1108,19 +1108,7 @@ public Set<NamespaceBundle> getOwnedServiceUnits() {
}

public boolean isServiceUnitOwned(ServiceUnitId suName) throws Exception {
Copy link
Contributor

Choose a reason for hiding this comment

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

as a follow up work we should remove this synchronous method

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes, let's address it in another PR.

@@ -1108,19 +1108,7 @@ public Set<NamespaceBundle> getOwnedServiceUnits() {
}

public boolean isServiceUnitOwned(ServiceUnitId suName) throws Exception {
if (suName instanceof TopicName) {
return isTopicOwnedAsync((TopicName) suName).get();
Copy link
Contributor

Choose a reason for hiding this comment

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

Are we safe to skip these checks?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes, you can see the isServiceUnitOwnedAsync method has the same checks.

@codecov-commenter
Copy link

Codecov Report

Merging #20528 (8035be2) into master (d7f3558) will increase coverage by 36.09%.
The diff coverage is 43.75%.

Impacted file tree graph

@@              Coverage Diff              @@
##             master   #20528       +/-   ##
=============================================
+ Coverage     36.82%   72.92%   +36.09%     
- Complexity    12040    31905    +19865     
=============================================
  Files          1690     1867      +177     
  Lines        128968   138548     +9580     
  Branches      14036    15216     +1180     
=============================================
+ Hits          47493   101034    +53541     
+ Misses        75220    29490    -45730     
- Partials       6255     8024     +1769     
Flag Coverage Δ
inttests 24.15% <6.25%> (-0.01%) ⬇️
systests 25.06% <6.25%> (+0.01%) ⬆️
unittests 72.19% <43.75%> (+40.29%) ⬆️

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

Impacted Files Coverage Δ
.../pulsar/functions/runtime/JavaInstanceStarter.java 0.00% <0.00%> (ø)
...he/pulsar/broker/admin/v2/NonPersistentTopics.java 61.92% <33.33%> (+34.14%) ⬆️
...pache/pulsar/broker/admin/v2/PersistentTopics.java 80.83% <33.33%> (+67.96%) ⬆️
...unctions/runtime/kubernetes/KubernetesRuntime.java 38.73% <50.00%> (+38.73%) ⬆️
...ache/pulsar/broker/namespace/NamespaceService.java 70.35% <100.00%> (+26.76%) ⬆️
...n/java/org/apache/pulsar/admin/cli/CmdSources.java 45.03% <100.00%> (+45.03%) ⬆️

... and 1429 files with indirect coverage changes

@Demogorgon314 Demogorgon314 merged commit 19face6 into apache:master Jun 8, 2023
@Demogorgon314 Demogorgon314 deleted the Demogorgon314/fix-ListInBundle branch June 8, 2023 05:58
@Technoboy- Technoboy- added this to the 3.1.0 milestone Jun 14, 2023
Technoboy- pushed a commit that referenced this pull request Jun 14, 2023
…list in bundle admin API (#20528)

PIP: #16691

When using `ExtensibleLoadManager` and list in bundle admin API,
it will redirect forever because `isServiceUnitOwned` method is checking the `ownershipCache` as the ownership storage, however, when using `ExtensibleLoadManager`, it stored the ownership to table view.

* Call `isServiceUnitOwnedAsync ` when using `isServiceUnitOwned `.
* Add unit test to cover this case.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/broker cherry-picked/branch-3.0 doc-not-needed Your PR changes do not impact docs ready-to-test release/3.0.1 type/bug The PR fixed a bug or issue reported a bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants