-
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][broker] PIP-192 Added namespace unload scheduler #19477
[improve][broker] PIP-192 Added namespace unload scheduler #19477
Conversation
83d58f8
to
95c4e96
Compare
...java/org/apache/pulsar/broker/loadbalance/extensions/scheduler/NamespaceUnloadScheduler.java
Outdated
Show resolved
Hide resolved
...java/org/apache/pulsar/broker/loadbalance/extensions/scheduler/NamespaceUnloadScheduler.java
Outdated
Show resolved
Hide resolved
if (debugMode) { | ||
log.info("Available brokers: {}", availableBrokers); | ||
} | ||
if (availableBrokers.size() <= 1) { |
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.
Can we move this logic to TransferShedder?( and accordingly emit the decision result)
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.
Why do we need to move to TransferShedder
? Are there any benefits? If only one broker is available, we don't need to do to unload.
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.
I thought in order to isolate shedding logic, all the major shedding decisions should happen in Shedding Strategy, but ok. Im fine with this outer logic too.
...java/org/apache/pulsar/broker/loadbalance/extensions/scheduler/NamespaceUnloadScheduler.java
Outdated
Show resolved
Hide resolved
...java/org/apache/pulsar/broker/loadbalance/extensions/scheduler/NamespaceUnloadScheduler.java
Outdated
Show resolved
Hide resolved
...java/org/apache/pulsar/broker/loadbalance/extensions/scheduler/NamespaceUnloadScheduler.java
Outdated
Show resolved
Hide resolved
...src/main/java/org/apache/pulsar/broker/loadbalance/extensions/ExtensibleLoadManagerImpl.java
Outdated
Show resolved
Hide resolved
if (unloadDecision.getUnloads().isEmpty()) { | ||
return CompletableFuture.completedFuture(null); | ||
} | ||
List<CompletableFuture<Void>> futures = new ArrayList<>(); |
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.
Add a member var private final Map<String, SplitDecision> inFlightUnloads
to dedup the in-flight unloads. We need to remove the item when BSC.closeServiceUnit()
is done.
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.
Here, I think we need SplitManager and UnloadManager
to manage the lifecycle of the bundle split and unload requests from each broker.
- dedup inflight bundles' unload/split event pub messages.
- update the success counters when the unload(closeServiceUnit) and split(splitServiceUnit) is complete.
Here is my temp code where I am trying to introduce SplitManager
for the same reason.
https://github.com/heesung-sn/pulsar/pull/30/files#r1103463024
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.
Or, I am fine with moving forward with the current code(without dedup) and refactoring it later when other PRs get merged.
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 need to remove the item when BSC.closeServiceUnit() is done.
Good catch! Since only the channel owner can do the bundle unload, removing the item when BSC.closeServiceUnit()
might not be a good idea. Maybe we should remove it when it received an Owned
state?
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, thats better. We can add this logic in handleOwned.
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.
Left some trivial comments.
...java/org/apache/pulsar/broker/loadbalance/extensions/scheduler/NamespaceUnloadScheduler.java
Outdated
Show resolved
Hide resolved
.../org/apache/pulsar/broker/loadbalance/extensions/scheduler/NamespaceUnloadSchedulerTest.java
Outdated
Show resolved
Hide resolved
95c4e96
to
1c7bdc4
Compare
Codecov Report
@@ Coverage Diff @@
## master #19477 +/- ##
============================================
+ Coverage 63.30% 64.02% +0.71%
- Complexity 26123 26252 +129
============================================
Files 1836 1837 +1
Lines 134416 134498 +82
Branches 14772 14782 +10
============================================
+ Hits 85087 86106 +1019
+ Misses 41649 40539 -1110
- Partials 7680 7853 +173
Flags with carried forward coverage won't be shown. Click here to find out more.
|
@Demogorgon314 please rebase |
# Conflicts: # pulsar-broker/src/main/java/org/apache/pulsar/broker/loadbalance/extensions/ExtensibleLoadManagerImpl.java
PIP-192: #16691
Motivation
We will start raising PRs to implement PIP-192, #16691
Modifications
This PR added a namespace unload scheduler and tests.
Documentation
doc
doc-required
doc-not-needed
doc-complete