-
Notifications
You must be signed in to change notification settings - Fork 3.7k
[fix][client] In method LastCumulativeAck#update, bitSetRecyclable does not update when messageId is equal. #18154
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -658,6 +658,16 @@ protected LastCumulativeAck initialValue() { | |||||||||||||
| private boolean flushRequired = false; | ||||||||||||||
|
|
||||||||||||||
| public synchronized void update(final MessageIdImpl messageId, final BitSetRecyclable bitSetRecyclable) { | ||||||||||||||
| if (messageId.equals(this.messageId)) { | ||||||||||||||
| if (this.bitSetRecyclable != null && bitSetRecyclable != null | ||||||||||||||
| && bitSetRecyclable.nextSetBit(0) > this.bitSetRecyclable.nextSetBit(0)) { | ||||||||||||||
| this.bitSetRecyclable.recycle(); | ||||||||||||||
| set(messageId, bitSetRecyclable); | ||||||||||||||
| flushRequired = true; | ||||||||||||||
| } | ||||||||||||||
| return; | ||||||||||||||
| } | ||||||||||||||
|
|
||||||||||||||
| if (messageId.compareTo(this.messageId) > 0) { | ||||||||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. seem compareTo has already compare the batchIndex. pulsar/pulsar-client/src/main/java/org/apache/pulsar/client/impl/MessageIdImpl.java Lines 248 to 253 in fa328a4
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. +1
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, you are right |
||||||||||||||
| if (this.bitSetRecyclable != null && this.bitSetRecyclable != bitSetRecyclable) { | ||||||||||||||
| this.bitSetRecyclable.recycle(); | ||||||||||||||
|
|
||||||||||||||
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.
We already have the compare sult, I think we can improve it like
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.
+1