-
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 race-condition causing repeated delete topic #23522
[fix] [broker] Fix race-condition causing repeated delete topic #23522
Conversation
…flaky group to unblock CI (apache#23478)" This reverts commit 6933a1d.
managed-ledger/src/main/java/org/apache/bookkeeper/mledger/impl/MetaStoreImpl.java
Outdated
Show resolved
Hide resolved
managed-ledger/src/main/java/org/apache/bookkeeper/mledger/impl/MetaStoreImpl.java
Show resolved
Hide resolved
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
pulsar-broker/src/main/java/org/apache/pulsar/broker/service/persistent/PersistentTopic.java
Show resolved
Hide resolved
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #23522 +/- ##
============================================
+ Coverage 73.57% 74.34% +0.77%
- Complexity 32624 34938 +2314
============================================
Files 1877 1943 +66
Lines 139502 147011 +7509
Branches 15299 16199 +900
============================================
+ Hits 102638 109299 +6661
- Misses 28908 29284 +376
- Partials 7956 8428 +472
Flags with carried forward coverage won't be shown. Click here to find out more.
|
pulsar-broker/src/main/java/org/apache/pulsar/broker/service/persistent/PersistentTopic.java
Show resolved
Hide resolved
(cherry picked from commit 7b80f01)
(cherry picked from commit 7b80f01)
(cherry picked from commit 7b80f01)
(cherry picked from commit 7b80f01)
Fixes #23474
Motivation
Background
A lock named
isClosingOrDeleting
prevents concurrently deleting/closing topicIssue 1: repeated delete a topic caused by a race condition
The code that deleting the topic is like below
The code in
PersistentTopic.delete
acquires the lock once, but releases it twice, which breaks the locker, and leads to multiple deleting runs at the same time.Issue 2:
MetaStoreImpl.getException
wrap aCompletionException
toMetaStoreException
deactivates the checker of deleting ML in the methodPersistentTopic.delete
There is a checker that broker will assumed the ML deleting is succeed if it has been deleted before, such as bellow:
But
MetaStoreImpl.getException
wrap aCompletionException
toMetaStoreException
, causing the catch block to get an error like thisMetaStoreException -> CompletionException -> NotFoundException
, it breaks the checker above.Modifications
flaky
Documentation
doc
doc-required
doc-not-needed
doc-complete
Matching PR in forked repository
PR in forked repository: x