-
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
[Enhancement] Nested read-write lock issue in ManagedCursor #23605
Comments
Personally, I don't think we need to |
Makes sense. I have a large changeset to address multiple performance issues with Broker cache and one of the changes is related: lhotari@a0d0b54 . I haven't yet split this large changeset into PRs for review. |
@lhotari Oh, I saw it! If you think it‘s necessary. Maybe you can solve the read-write lock nesting problem mentioned in this issue in your pr. |
@Denovo1998 you can go ahead and create a PR if you wish. |
Addressed by #23609 |
Search before asking
Motivation
The following are all related to the
org.apache.bookkeeper.mledger.impl.ManagedCursorImpl#isMessageDeleted
:pulsar/managed-ledger/src/main/java/org/apache/bookkeeper/mledger/impl/ManagedCursorImpl.java
Lines 3542 to 3551 in 89ccb73
A write lock has already been acquired, but a read lock has been acquired as well. This doesn't pose a major problem, but it does result in some unnecessary additional overhead.
pulsar/managed-ledger/src/main/java/org/apache/bookkeeper/mledger/impl/ManagedCursorImpl.java
Lines 2328 to 2348 in 89ccb73
The performance impact of nested read locks can be negligible, but frequent acquisition and release of locks will slightly increase system overhead.
pulsar/managed-ledger/src/main/java/org/apache/bookkeeper/mledger/impl/ManagedCursorImpl.java
Lines 1570 to 1575 in 89ccb73
Solution
Add a method that does not require a read lock.
Alternatives
No response
Anything else?
I think the modification at 22246 here is for code reuse, but the nested read-write locks in these two segments may need to be modified.
If such a modification is necessary, please let me know, and I will submit a simple PR.
Are you willing to submit a PR?
The text was updated successfully, but these errors were encountered: