-
Notifications
You must be signed in to change notification settings - Fork 3.7k
[fix][broker]Persist cursor info error when cursor close #17255
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
Merged
Technoboy-
merged 3 commits into
apache:master
from
poorbarcode:fix/closeCursorWhenLedgerWrong
Aug 25, 2022
Merged
[fix][broker]Persist cursor info error when cursor close #17255
Technoboy-
merged 3 commits into
apache:master
from
poorbarcode:fix/closeCursorWhenLedgerWrong
Aug 25, 2022
+51
−2
Conversation
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
Technoboy-
approved these changes
Aug 24, 2022
mattisonchao
approved these changes
Aug 24, 2022
Member
mattisonchao
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.
LGTM
yuruguo
approved these changes
Aug 24, 2022
Contributor
Author
|
/pulsarbot rerun-failure-checks |
Technoboy-
pushed a commit
to Technoboy-/pulsar
that referenced
this pull request
Aug 25, 2022
Nicklee007
pushed a commit
to Nicklee007/pulsar
that referenced
this pull request
Aug 29, 2022
4 tasks
zymap
pushed a commit
that referenced
this pull request
Sep 15, 2022
(cherry picked from commit 46b1239)
tisonkun
pushed a commit
to tisonkun/pulsar
that referenced
this pull request
Jul 12, 2023
Pulsar Consumer would be closed in SplitReader if it reaches the end of split. The registered Consumer would also be closed in PulsarClient if we call PulsarClient.close(). This would cause race condition. We have to use PulsarClient.shutdown() which don't close Consumer instead. This closes apache#17255
lhotari
added a commit
to lhotari/pulsar
that referenced
this pull request
Jul 26, 2025
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
area/broker
cherry-picked/branch-2.8
Archived: 2.8 is end of life
cherry-picked/branch-2.9
Archived: 2.9 is end of life
cherry-picked/branch-2.11
doc-not-needed
Your PR changes do not impact docs
release/2.8.5
release/2.9.4
type/bug
The PR fixed a bug or issue reported a bug
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
When we call
cursor.closewill trigger cursor info persistent, there are two steps to persistence( ensure as little data loss as possible ):Here's how we want it to work:
closingclosed(High light)But there's something wrong with this code, here's how it exactly works:
closing3-1. if Bookie doesn't work, try to persist to ZK. (High light) this command asynchronously works on thread
bk client worker, and will fail caused of cursor state check(see code below).3-2. change state to
closedpulsar/managed-ledger/src/main/java/org/apache/bookkeeper/mledger/impl/ManagedCursorImpl.java
Lines 2474 to 2478 in b0909ab
Modifications
Make
change cursor state to closingalways be executed after persistenceDocumentation
doc-requireddoc-not-neededdocdoc-complete