-
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
[fix][broker] Fix the broker registering might be blocked for long time #23371
Merged
codelipenghui
merged 5 commits into
apache:master
from
BewareMyPower:bewaremypower/fix-broker-registry-test
Sep 30, 2024
Merged
[fix][broker] Fix the broker registering might be blocked for long time #23371
codelipenghui
merged 5 commits into
apache:master
from
BewareMyPower:bewaremypower/fix-broker-registry-test
Sep 30, 2024
Conversation
This file contains 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
BewareMyPower
added
type/bug
The PR fixed a bug or issue reported a bug
area/client
area/broker
type/flaky-tests
release/3.3.2
labels
Sep 29, 2024
BewareMyPower
requested review from
lhotari,
codelipenghui,
Demogorgon314 and
heesung-sn
September 29, 2024 07:55
heesung-sn
reviewed
Sep 29, 2024
pulsar-client/src/main/java/org/apache/pulsar/client/impl/TableViewImpl.java
Outdated
Show resolved
Hide resolved
pulsar-client/src/main/java/org/apache/pulsar/client/impl/TableViewImpl.java
Show resolved
Hide resolved
heesung-sn
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-sn
pushed a commit
to heesung-sn/pulsar
that referenced
this pull request
Oct 23, 2024
…me (apache#23371) (cherry picked from commit 7d7dc80)
heesung-sn
pushed a commit
to heesung-sn/pulsar
that referenced
this pull request
Oct 23, 2024
…me (apache#23371) (cherry picked from commit 7d7dc80)
heesung-sn
added a commit
that referenced
this pull request
Oct 23, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
area/broker
area/client
cherry-picked/branch-3.3
doc-not-needed
Your PR changes do not impact docs
ready-to-test
release/3.3.3
type/bug
The PR fixed a bug or issue reported a bug
type/flaky-tests
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
BrokerRegistryImpl
are 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,
registerAsync
would have to wait until these methods are done, while they could have been recovered by aregisterAsync
call.While the direct cause of failed
BrokerRegistryIntegrationTest
is thatTableViewImpl#flush
would not complete if there is no message in the topic. See #23365 (comment)Modifications
Two fixes:
TableViewImpl#flush
by filtering the empty topics via checking if the last message id's entry id is non-negativeregisterAsync
directly 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:
BrokerRegistryIntegrationTest
again to verify fix 1 worksBrokerRegistryMetadataStoreIntegrationTest
to verify fix 2 worksDocumentation
doc
doc-required
doc-not-needed
doc-complete
Matching PR in forked repository
PR in forked repository: