-
Notifications
You must be signed in to change notification settings - Fork 3.7k
[fix] [transaction] infinite loop task that pengding ack log replay #16240
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
Conversation
17887d8 to
3a0a7f6
Compare
|
@congbobo184 @liangyepianzhou Could you take a look, thanks. ^_^ |
|
@poorbarcode Please provide a correct documentation label for your PR. |
|
/pulsarbot run-failure-checks |
|
@poorbarcode Please provide a correct documentation label for your PR. |
|
/pulsarbot run-failure-checks |
|
@poorbarcode Please provide a correct documentation label for your PR. |
|
The cursor of the pending ack log is only used when it is created and recovered, so it will not go to the cache. |
liangyepianzhou
left a comment
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.
Is it better to delete the cursor after recovery is complete?
| public void openCursorComplete(ManagedCursor cursor, Object ctx) { | ||
| // Why "rewind" ? | ||
| // see: https://github.com/apache/pulsar/pull/16240 | ||
| cursor.rewind(); |
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.
Is it better to delete the cursor after recovery is complete?
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.
Is it better to delete the cursor after recovery is complete?
No, that won't solve this problem. #16247 can solve this problem, I am thinking of closing this PR
Yes, It is #16247 |
|
#16247 can solve this problem, close this PR |
Motivation
pending-ack-cursorwill reload byMLPendingAckStoreProviderwhen createdpersistent subscription, it will check the cache firstly, and create a new one if the cache does not exist.pulsar/managed-ledger/src/main/java/org/apache/bookkeeper/mledger/impl/ManagedLedgerImpl.java
Lines 928 to 935 in eeb22ba
The managed ledger and cursor which already exist may be like this:
So
MLPendingAckStorewill initialize like this:At this point, we expected four logs to be read, but none were. And then it goes into an infinite loop.
pulsar/pulsar-broker/src/main/java/org/apache/pulsar/broker/transaction/pendingack/impl/MLPendingAckStore.java
Lines 332 to 355 in 877795e
And we should not lose these four logs while executing A, because they may be in a transaction that has not yet handle, so we should reset the read position of the pending-ack-log cursor.
Modifications
Consistently execute 'cursor.rewind' after pending-ack-log cursor initialize.
Documentation
doc-requireddoc-not-neededdocdoc-complete