[fix][broker] Fix namespace bundle stuck in unloading status - #21445
Merged
Conversation
mattisonchao
marked this pull request as draft
October 26, 2023 02:14
mattisonchao
marked this pull request as ready for review
October 26, 2023 10:12
lhotari
reviewed
Nov 1, 2023
mattisonchao
marked this pull request as draft
November 1, 2023 23:04
mattisonchao
marked this pull request as ready for review
November 2, 2023 11:14
| }); | ||
| } | ||
| return loadOrCreatePersistentTopic(tpName, createIfMissing, properties); | ||
| final CompletableFuture<Optional<TopicPolicies>> topicPoliciesFuture = |
Member
There was a problem hiding this comment.
Do we have a test to cover the getTopic method and the TopicPolicies are loaded?
Demogorgon314
approved these changes
Nov 6, 2023
codelipenghui
left a comment
Contributor
There was a problem hiding this comment.
The change looks good.
Just left a few minor comments.
Technoboy-
approved these changes
Nov 7, 2023
poorbarcode
approved these changes
Nov 7, 2023
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #21445 +/- ##
============================================
+ Coverage 73.23% 73.24% +0.01%
+ Complexity 32674 32648 -26
============================================
Files 1892 1892
Lines 140632 140645 +13
Branches 15467 15467
============================================
+ Hits 102986 103010 +24
+ Misses 29565 29519 -46
- Partials 8081 8116 +35
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
4 tasks
Technoboy-
pushed a commit
that referenced
this pull request
Nov 10, 2023
PR #21231 made user topic creation rely on system topic `__change_event` if the user is enabling `topicLevelPoliciesEnabled`. It will introduce a race condition with namespace bundle unloading. All creating topics want to create `__change_event` reader but constantly fail by namespace-bundle inactive and retry mechanism. Unfortunately, the namespace-bundle unloading operation is waiting for all the topics to be completed and then release inactive status. Therefore, they will be stuck in a deadlock until one gets a timeout. - Get the topic policy before loading.
1 task
1 task
1 task
nborisov
pushed a commit
to nborisov/pulsar
that referenced
this pull request
Nov 13, 2023
…21445) ### Motivation PR apache#21231 made user topic creation rely on system topic `__change_event` if the user is enabling `topicLevelPoliciesEnabled`. It will introduce a race condition with namespace bundle unloading. All creating topics want to create `__change_event` reader but constantly fail by namespace-bundle inactive and retry mechanism. Unfortunately, the namespace-bundle unloading operation is waiting for all the topics to be completed and then release inactive status. Therefore, they will be stuck in a deadlock until one gets a timeout. ### Modifications - Get the topic policy before loading.
poorbarcode
pushed a commit
that referenced
this pull request
Nov 14, 2023
Technoboy-
added a commit
that referenced
this pull request
Nov 16, 2023
mattisonchao
added a commit
that referenced
this pull request
Nov 20, 2023
coderzc
pushed a commit
to coderzc/pulsar
that referenced
this pull request
Nov 21, 2023
…21445) (apache#21565) Cherry-pick apache#21445 to branch-3.0
nodece
pushed a commit
to ascentstream/pulsar
that referenced
this pull request
Dec 2, 2023
…21445) (apache#21567) Co-authored-by: Jiwe Guo <technoboy@apache.org>
nikhil-ctds
pushed a commit
to datastax/pulsar
that referenced
this pull request
Dec 20, 2023
…21445) PR apache#21231 made user topic creation rely on system topic `__change_event` if the user is enabling `topicLevelPoliciesEnabled`. It will introduce a race condition with namespace bundle unloading. All creating topics want to create `__change_event` reader but constantly fail by namespace-bundle inactive and retry mechanism. Unfortunately, the namespace-bundle unloading operation is waiting for all the topics to be completed and then release inactive status. Therefore, they will be stuck in a deadlock until one gets a timeout. - Get the topic policy before loading.
srinath-ctds
pushed a commit
to datastax/pulsar
that referenced
this pull request
Dec 20, 2023
…21445) PR apache#21231 made user topic creation rely on system topic `__change_event` if the user is enabling `topicLevelPoliciesEnabled`. It will introduce a race condition with namespace bundle unloading. All creating topics want to create `__change_event` reader but constantly fail by namespace-bundle inactive and retry mechanism. Unfortunately, the namespace-bundle unloading operation is waiting for all the topics to be completed and then release inactive status. Therefore, they will be stuck in a deadlock until one gets a timeout. - Get the topic policy before loading.
BewareMyPower
added a commit
to BewareMyPower/pulsar
that referenced
this pull request
Feb 2, 2024
…licies before loading topics ### Motivation apache#21445 introduces an implicit requirement that if the topic policies cannot be loaded, `BrokerService#getTopic` will fail and then the client will retry loading the topic. It could break some existing usages like the tests in the C++ client: apache/pulsar-client-cpp#394 This change is applied only to avoid the race condition when unloading a namespace bundle. However, the client should not fail if the topic-level policies are not available. ### Modifications If the topic policies cannot be loaded due to a non-retryable error, we should not fail the `getTopic`. For retryable errors, the client will still retry until the broker gets the topic-level policies successfully after some attempts. Modify `TokenAuthenticatedProducerConsumerTest` to protect the change.
4 tasks
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.
Motivation
PR #21231 made user topic creation rely on system topic
__change_eventif the user is enablingtopicLevelPoliciesEnabled.It will introduce a race condition with namespace bundle unloading. All creating topics want to create
__change_eventreader but constantly fail by namespace-bundle inactive and retry mechanism. Unfortunately, the namespace-bundle unloading operation is waiting for all the topics to be completed and then release inactive status. Therefore, they will be stuck in a deadlock until one gets a timeout.Modifications
Verifying this change
Documentation
docdoc-requireddoc-not-neededdoc-complete