-
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] Fix broker restart logic #20113
[improve] [broker] Fix broker restart logic #20113
Conversation
Signed-off-by: xiaolongran <[email protected]>
@wolfstudy Please add the following content to your PR description and select a checkbox:
|
/pulsarbot run-failure-checks |
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.
Good catch!
/pulsarbot run-failure-checks |
Codecov Report
@@ Coverage Diff @@
## master #20113 +/- ##
=============================================
+ Coverage 33.16% 72.94% +39.78%
- Complexity 12225 31911 +19686
=============================================
Files 1499 1868 +369
Lines 114340 138318 +23978
Branches 12415 15214 +2799
=============================================
+ Hits 37918 100897 +62979
+ Misses 71484 29398 -42086
- Partials 4938 8023 +3085
Flags with carried forward coverage won't be shown. Click here to find out more.
|
(cherry picked from commit 092819b)
(cherry picked from commit 092819b)
(cherry picked from commit 092819b)
Motivation
Currently, when we execute the logic of Broker Close, we first shut down the Broker Service, and then close the LoadManagerTask. This will cause the Broker to be assigned to a new bundle during the shutdown of the Broker, resulting in an inelegant shutdown of the Broker. , eventually triggering brokerShutdownTimeoutMs to forcibly shut down the Broker, causing the Client to fail to produce or consume messages over time.
When shutting down the Broker, we will first remove the temporary node of the current Broker from zookeeper, which is the logic we expect. We expect that the broker will not allocate new bundles during active shutdown of the broker. However, since the task of loadManagerExecutor has been regularly executed to report its own Load information to zookeeper, this will cause the Broker node to be shut down to be re-registered by loadManagerExecutor. At this time, the Leader Broker believes that the Broker node to be shut down can also allocate a new bundle, and will redistribute the new bundle information.
Interestingly, in the code logic of Pulsar Service shutdown, the comments clearly indicate that we expect LoadMangerTask to be closed before Broker Service, but in real code implementation, it is the opposite.
Modifications
Adjust the order of component shutdown when Broker is shut down so that LoadManagerTask is shut down before Broker Service
doc
doc-required
doc-not-needed
doc-complete