-
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] refactor cursor read entry process to fix dead loop read issue of txn #22944
base: master
Are you sure you want to change the base?
[fix][broker] refactor cursor read entry process to fix dead loop read issue of txn #22944
Conversation
The implementation seems could work, but I'm not sure is it a good idea that maintain |
managed-ledger/src/main/java/org/apache/bookkeeper/mledger/impl/ManagedCursorImpl.java
Outdated
Show resolved
Hide resolved
// because readPosition > maxReadPosition | ||
|
||
// Skip deleted entries. | ||
skipCondition = skipCondition == null ? this::isMessageDeleted : skipCondition.or(this::isMessageDeleted); |
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.
it is better to simple the code since there are some code duplications.
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.
have done.
} | ||
|
||
if (isClosed()) { | ||
callback.readEntriesFailed(new CursorAlreadyClosedException("Cursor was already closed"), ctx); |
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.
need to release ReadEntryOp here?
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.
I think so. need to recycle the op first. But this is better fixed by another pr.
callback.readEntriesFailed(new NoMoreEntriesToReadException("Topic was terminated"), ctx); | ||
} | ||
} catch (Throwable t) { | ||
callback.readEntriesFailed(new ManagedLedgerException(t), ctx); |
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.
need to release ReadEntryOp?
// At this point we registered for notification and still there were no more available | ||
// entries by maxReadPosition. | ||
// If the managed ledger was indeed terminated, we need to notify the cursor | ||
callback.readEntriesFailed(new NoMoreEntriesToReadException("Topic was terminated"), ctx); |
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.
need to release ReadEntryOp?
2760f43
to
5f68a58
Compare
Firstly I also try to remove |
PTAL, thanks. @congbobo184 @liangyepianzhou |
0d0b50b
to
e3a93a3
Compare
e3a93a3
to
fb15ec6
Compare
@TakaHiR07 Do you have a chance to rebase this PR? |
fb15ec6
to
12b4056
Compare
@lhotari have rebase. |
Motivation
This pr is similar to a previous pr #14286. Since previous pr is closed, I implement it in master branch and improve some logic and add some test.
Modifications
Currently :
I make many comments in the code, which maybe the concerned point.
And this pr try to retain the same process as before if disable txn. Aiming to fix the issue after enable txn.
Verifying this change
(Please pick either of the following options)
This change is a trivial rework / code cleanup without any test coverage.
(or)
This change is already covered by existing tests, such as (please describe tests).
(or)
This change added tests and can be verified as follows:
(example:)
Does this pull request potentially affect one of the following parts:
If the box was checked, please highlight the changes
Documentation
doc
doc-required
doc-not-needed
doc-complete
Matching PR in forked repository
PR in forked repository: