-
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
[Issue 12726][broker] Fix deadlock in metadata-store callback thread #12753
Conversation
|
||
public HierarchyTopicPolicies() { | ||
inactiveTopicPolicies = new PolicyHierarchyValue<>(); | ||
maxSubscriptionsPerTopic = new PolicyHierarchyValue<>(); | ||
backLogQuotaMap = new HashMap<>(); |
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.
Can the map be accessed by multiple threads?
And I think it should be PolicyHierarchyValue<Map<BacklogQuota.BacklogQuotaType, BacklogQuota>>?
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.
Can the map be accessed by multiple threads?
Yes, thanks for the reminding. ImmutableMap is a better choice here.
And I think it should be PolicyHierarchyValue<Map<BacklogQuota.BacklogQuotaType, BacklogQuota>>?
With this, there will be a problem under this case:
TopicLevelSettings : destination_storage --> BacklogQuota1, message_age --> null
BrokerSettings : destination_storage --> null, message_age --> BacklogQuota2
With PolicyHierarchyValue<Map<...>>, the value of type message_age
would be null.
With Map, the value will be "BacklogQuota2".
In previous logic, the result seems to be "BacklogQuota2".
I will add a test case to verify this.
/pulsarbot run-failure-checks |
… metadata query in metadata-callback thread.
…PolicyHierarchyValue
/pulsarbot run-failure-checks |
/pulsarbot run-failure-checks |
4 similar comments
/pulsarbot run-failure-checks |
/pulsarbot run-failure-checks |
/pulsarbot run-failure-checks |
/pulsarbot run-failure-checks |
…uplicationTest#testIsDuplicateWithFailure
@codelipenghui Updated, please help review again.
|
@315157973 Would you please help review this? |
pulsar-broker/src/main/java/org/apache/pulsar/broker/service/persistent/PersistentTopic.java
Outdated
Show resolved
Hide resolved
...-broker/src/main/java/org/apache/pulsar/broker/service/nonpersistent/NonPersistentTopic.java
Show resolved
Hide resolved
/pulsarbot run-failure-checks |
@315157973 Fixed the previous bug. PTAL. |
@codelipenghui Can you help merge this please? |
…pache#12753) Fixes apache#12726 ### Motivation See apache#12726 ### Modifications Use PolicyHierarchyValue to cache backlogQuota policies to avoid calling blocking metadata query in metadata-callback thread.
…pache#12753) Fixes apache#12726 ### Motivation See apache#12726 ### Modifications Use PolicyHierarchyValue to cache backlogQuota policies to avoid calling blocking metadata query in metadata-callback thread.
…pache#12753) Fixes apache#12726 ### Motivation See apache#12726 ### Modifications Use PolicyHierarchyValue to cache backlogQuota policies to avoid calling blocking metadata query in metadata-callback thread.
Fixes #12726
Motivation
See #12726
Modifications
Use PolicyHierarchyValue to cache backlogQuota policies to avoid calling blocking metadata query in metadata-callback thread.
Verifying this change
This change is already covered by existing tests, such as pulsar-broker/src/test/java/org/apache/pulsar/broker/admin/TopicPoliciesTest.java
Does this pull request potentially affect one of the following parts:
If
yes
was chosen, please highlight the changesDocumentation
Check the box below and label this PR (if you have committer privilege).
Need to update docs?
no-need-doc
Bug fix.