-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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][admin,broker] Add option to unloadNamespaceBundle with bundle Affinity broker url #18663
Conversation
@vineeth1995 Please select only one documentation label in your PR description. |
@vineeth1995 Thanks for the contribution. |
Codecov Report
@@ Coverage Diff @@
## master #18663 +/- ##
============================================
+ Coverage 47.36% 47.46% +0.09%
- Complexity 10716 10733 +17
============================================
Files 712 712
Lines 69541 69598 +57
Branches 7466 7470 +4
============================================
+ Hits 32941 33034 +93
+ Misses 32894 32852 -42
- Partials 3706 3712 +6
Flags with carried forward coverage won't be shown. Click here to find out more.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A proposal is required since the PR is changed the Admin API and introduced a new feature.
@codelipenghui I don't think this will require PIP as it's part of adding a flag in admin API. There are a large number of PRs which must have gone through PIP with similar changes but merge without any explanation. let me give you few examples also PR which breaks backward compatibility #10601 was merged without any concerns. |
@codelipenghui I know there were multiple genuine PRs were blocked in past and they were sitting unmerged for a long time for multiple releases. I can clearly see the intention but we should avoid such destructive practice instead we should spend time in constructive efforts as not every contributor is vendor but users/companies are trying to contribute for their business usecases and such practice discourages companies to use Pulsar. |
@codelipenghui can you please unblock the PR? |
@codelipenghui ping |
this PR is blocked for last 3 days and I haven't heard anything from @codelipenghui . can we unblock the PR or dismiss the review? we can't keep following up on the same thing again and again. |
@codelipenghui waiting for your reply to remove the blocker? It's not acceptable to block the PR and not replying here. |
Sorry for the late response. Yes, this is why I think it's better to have a proposal to avoid we will not introduce any API changes without a proposal in the future. I agree there are many changes to admin APIs without proposals/discussions. But we are on the wrong way, right? More and more people are starting to use Pulsar. We should be more careful about the API changes than ever. I want to say there have been many CLI, and admin API changes without proposals before. If you just don't think we should not start with this PR(proposal required). It's ok for me. I think I should start a discussion under the mailing list first, not block this PR under an uncleared rule. I see all the PRs you provided are from StreamNative's engineers. Please don't think I mean to facilitate StreamNative engineers. Here is an example of a proposal that is not required for new metrics. |
There have been many CLI, and admin API changes without proposals before. It's better to have a discussion under the mailing list first.
@@ -863,6 +866,50 @@ protected BookieAffinityGroupData internalGetBookieAffinityGroup() { | |||
} | |||
} | |||
|
|||
private void validateLeaderBroker() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's better to make this async
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we make it async, the result could be indeterministic. If the bundle-broker mapping is not set by the time loadmanager loads the bundle, it will unload the bundle onto wrong broker.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, it's dependent and we don't have to make it async here for this admin-api.
@@ -1443,6 +1447,15 @@ public void doNamespaceBundleSplit() throws Exception { | |||
} | |||
} | |||
|
|||
@Override | |||
public String setNamespaceBundleAffinity(String bundle, String broker) { | |||
if (broker == null) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
StringUtils.isBlank
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
addressed
|
||
@Override | ||
public String setNamespaceBundleAffinity(String bundle, String broker) { | ||
if (broker == null) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
StringUtils.isBlank
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
addressed
@@ -142,4 +146,12 @@ public void stop() throws PulsarServerException { | |||
} | |||
} | |||
|
|||
@Override | |||
public String setNamespaceBundleAffinity(String bundle, String broker) { | |||
if (broker == null) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
StringUtils.isBlank
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
addressed
@@ -146,4 +146,16 @@ public Set<String> getAvailableBrokers() throws Exception { | |||
public CompletableFuture<Set<String>> getAvailableBrokersAsync() { | |||
return loadManager.getAvailableBrokersAsync(); | |||
} | |||
|
|||
private SimpleResourceUnit buildBrokerResourceUnit (String broker) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One more blank here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
addressed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
After reviewing all the changes, the PR introduced a new concept, bundle affinity
, right? It's not only a new option for Admin API.
IMO, it should be 2 parts.
- Namespace bundle affinity
- Unload the namespace bundle with affinity (or we can just split it into 2 steps, set affinity, unload bundle)
And I don't see the bundleBrokerAffinityMap will be persistent somewhere. The bundle affinity will disappear after the broker restarts?
Sorry, I have to give a request changes
here.
Yes, that's the purpose. we don't want persistent mapping it's useful when you want to debug by moving bundle temporarily to the specific broker. We already have namespace isolation policy for persistent affinity.
No, it's connected to each other where you want to unload bundle by setting specific broker affinity for temporary testing and you don't want to keep it persistent. Here, the main idea is to keep it non-persistent for quick testing, which is the main motivation to help users in debugging.
Let me know if you have any more concern so, we can remove the hold. |
b17fcc4
to
85800be
Compare
@rdhabalia Thanks for the explanation. Clear for me now. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very good
I generally support this work.
I left one minor comment that is worth to be addressed
log.error("The leader broker url is malformed - {}", leaderBrokerUrl); | ||
throw new RestException(exception); | ||
} catch (ExecutionException | InterruptedException exception) { | ||
log.error("Leader broker not found - {}", leaderBrokerUrl); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ExecutionException may mean many things,
We should unwrap the cause
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
addressed
CompletableFuture<LookupResult> result = pulsar().getNamespaceService() | ||
.createLookupResult(leaderBrokerUrl, false, null); | ||
try { | ||
LookupResult lookupResult = result.get(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should always set a timeout, otherwise the thread may be stuck forever
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
addressed
… bundle Affinity broker url
…bundle Affinity broker url
…le Affinity broker url
…le Affinity broker url
…le Affinity broker url
…le Affinity broker url
…le Affinity broker url
…le Affinity broker url
…le Affinity broker url
…le Affinity broker url
…le Affinity broker url
…le Affinity broker url
…le Affinity broker url
85800be
to
e86bdb1
Compare
@eolivelli I addressed your comments. |
@eolivelli can you remove the blocker? |
Lgtm Please rebase. |
Since this is the first case, I made it a demo to be referred to later. Hopefully, we don't have new cases, but we only need to clear the backlog. |
Merging... |
Motivation
To provide an option for admin to unload namespace bundle with broker url to which the bundle has to be assigned to after the unload.
Modifications
Add an option to provide brokerWebServiceAddress (Ex: https://broker1.com:4443) while unloadingNamespaceBundle in the admin CLI and make corresponding changes in the pulsar-client-admin-api to support this.
Changes in pulsar-broker unloadNamespaceBundle API to accommodate broker url while unloading.
Add functionality in LoadManger implementation to select affinity broker for a bundle while trying to assign unloaded bundle to broker.
Verifying this change
This change added tests and can be verified as follows:
Does this pull request potentially affect one of the following parts:
If the box was checked, please highlight the changes
Documentation
doc
doc-required
doc-not-needed
doc-complete
Matching PR in forked repository
PR in forked repository: