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

[improve][broker] Make get list from bundle Admin API async #20652

Conversation

Demogorgon314
Copy link
Member

Motivation

See: #14365, and fix when using ExtensibleLoadManagerImpl and validateNamespaceBundleOwnershipAsync methods. It should redirect to the owner broker.

Modifications

Make NonPersistentTopics#getListFromBundle to pure async.

Documentation

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

@Demogorgon314 Demogorgon314 self-assigned this Jun 27, 2023
@github-actions github-actions bot added the doc-not-needed Your PR changes do not impact docs label Jun 27, 2023
}
asyncResponse.resume(topicList);
} catch (Exception e) {
log.error("[{}] Failed to list topics on namespace bundle {}/{}", clientAppId(),
Copy link
Contributor

Choose a reason for hiding this comment

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

We can remove try/catch block

.host(webUrl.get().getHost())
.port(webUrl.get().getPort())
.replaceQueryParam("authoritative", newAuthoritative);
if (!ExtensibleLoadManagerImpl.isLoadManagerExtensionEnabled(config())) {
Copy link
Contributor

@gaoran10 gaoran10 Jun 27, 2023

Choose a reason for hiding this comment

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

Do we need to add this condition? And I'm not sure why need to reset the query param "destinationBroker".

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, for the extensible load manager, the transfer operation needs to use destinationBroker as the destination broker.

Copy link
Contributor

@gaoran10 gaoran10 Jun 28, 2023

Choose a reason for hiding this comment

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

Got it, thanks. Before, the param destinationBroker was only used by the bundle unload command, so it's a little confusing.

The bundle unload command with the param destinationBroker can't work with the extensible load manager, right?

Copy link
Member Author

@Demogorgon314 Demogorgon314 Jun 28, 2023

Choose a reason for hiding this comment

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

Before, the destinationBroker is set in the leader broker's ModularLoadManagerImpl#bundleBrokerAffinityMap, so it requires redirecting to the leader and setting the destinationBroker before doing in the real unload operation.

The unload operation requires execution in the owner broker, which will redirect to the owner broker after setting the destinationBroker success. If we don't clean the destinationBroker parameter, it will fall into a loop.

The ExtensibleLoadManagerImpl used a different way to transfer the ownership to destinationBroker, so we do not need to clean the destinationBroker parameter when redirecting. Since the destinationBroker do not set in the leader broker.

For the detail, you can check this method: https://github.com/apache/pulsar/blob/master/pulsar-broker/src/main/java/org/apache/pulsar/broker/admin/impl/NamespacesBase.java#L954

Copy link
Contributor

Choose a reason for hiding this comment

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

nit: ppl will appreciate it if you can add these details as a comment.

Copy link
Contributor

Choose a reason for hiding this comment

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

Got it, thanks.

@Demogorgon314 Demogorgon314 force-pushed the Demogorgon314/make-getListFromBundle-async branch from c3fa77c to 45aa66a Compare June 29, 2023 12:14
@codecov-commenter
Copy link

Codecov Report

Merging #20652 (45aa66a) into master (0e60340) will increase coverage by 0.57%.
The diff coverage is 90.00%.

Impacted file tree graph

@@             Coverage Diff              @@
##             master   #20652      +/-   ##
============================================
+ Coverage     72.60%   73.17%   +0.57%     
- Complexity    32018    32068      +50     
============================================
  Files          1855     1867      +12     
  Lines        138569   138760     +191     
  Branches      15250    15264      +14     
============================================
+ Hits         100605   101537     +932     
+ Misses        29945    29185     -760     
- Partials       8019     8038      +19     
Flag Coverage Δ
inttests 24.14% <80.00%> (+0.03%) ⬆️
systests 24.93% <0.00%> (?)
unittests 72.45% <90.00%> (+0.09%) ⬆️

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

Impacted Files Coverage Δ
...he/pulsar/broker/admin/v2/NonPersistentTopics.java 62.55% <86.95%> (+0.63%) ⬆️
...rg/apache/pulsar/broker/web/PulsarWebResource.java 64.66% <100.00%> (+0.05%) ⬆️

... and 166 files with indirect coverage changes

@Technoboy- Technoboy- merged commit 4958f45 into apache:master Jun 30, 2023
44 checks passed
@Demogorgon314 Demogorgon314 deleted the Demogorgon314/make-getListFromBundle-async branch June 30, 2023 01:39
lhotari pushed a commit that referenced this pull request Mar 6, 2024
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.

None yet

7 participants