[fix][broker] Fix the broker registering might be blocked for long time - #23371
Merged
codelipenghui merged 5 commits intoSep 30, 2024
Merged
Conversation
BewareMyPower
requested review from
Demogorgon314,
codelipenghui,
heesung-sohn and
lhotari
September 29, 2024 07:55
heesung-sohn
approved these changes
Sep 30, 2024
Demogorgon314
approved these changes
Sep 30, 2024
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #23371 +/- ##
============================================
+ Coverage 73.57% 74.56% +0.98%
- Complexity 32624 34485 +1861
============================================
Files 1877 1934 +57
Lines 139502 145137 +5635
Branches 15299 15870 +571
============================================
+ Hits 102638 108218 +5580
+ Misses 28908 28628 -280
- Partials 7956 8291 +335
Flags with carried forward coverage won't be shown. Click here to find out more.
|
2 tasks
heesung-sohn
pushed a commit
to heesung-sohn/pulsar
that referenced
this pull request
Oct 23, 2024
…me (apache#23371) (cherry picked from commit 7d7dc80)
heesung-sohn
pushed a commit
to heesung-sohn/pulsar
that referenced
this pull request
Oct 23, 2024
…me (apache#23371) (cherry picked from commit 7d7dc80)
heesung-sohn
added a commit
that referenced
this pull request
Oct 23, 2024
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #23365
Motivation
#23359 would register the broker again if the registered metadata node was somehow deleted. However, the listeners in
BrokerRegistryImplare triggered in the load manager thread (viaPulsar#Service#loadManagerExecutor).pulsar/pulsar-broker/src/main/java/org/apache/pulsar/broker/loadbalance/extensions/BrokerRegistryImpl.java
Lines 229 to 233 in 5e832a1
However, this thread executes many blocking tasks, including
monitor(),playLeader()andplayFollower()ofExtensibleLoadManagerImpl. If there were no available brokers, the blocking tasks might never complete until timeout exceeds. Here is an example:In this case,
registerAsyncwould have to wait until these methods are done, while they could have been recovered by aregisterAsynccall.While the direct cause of failed
BrokerRegistryIntegrationTestis thatTableViewImpl#flushwould not complete if there is no message in the topic. See #23365 (comment)Modifications
Two fixes:
TableViewImpl#flushby filtering the empty topics via checking if the last message id's entry id is non-negativeregisterAsyncdirectly in the metadata store callback thread instead of the load manager thread. It's an asynchronous metadata store operation so it won't block the thread.Tests enhancements:
BrokerRegistryIntegrationTestagain to verify fix 1 worksBrokerRegistryMetadataStoreIntegrationTestto verify fix 2 worksDocumentation
docdoc-requireddoc-not-neededdoc-completeMatching PR in forked repository
PR in forked repository: