-
Notifications
You must be signed in to change notification settings - Fork 962
[fix] DigestManager should not advance readerIndex #3919
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] DigestManager should not advance readerIndex #3919
Conversation
eolivelli
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.
Great catch!
@hangc0276 this is a bad regression we should cut a new release ASAP
horizonzy
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
wenbingshen
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.
Nice Catch!
How this bug happens on the Pulsar sideReproduce steps
How this bug happens
|
@eolivelli Sure, I will cut 4.16.1 that just include this PR soon. |
(cherry picked from commit df44920)
Descriptions of the changes in this PR:
#3783 introduced a change in the behavior of
LedgerHandle#asyncAddEntry. This PR re-introduces the original behavior.Motivation
Apache Pulsar just upgraded to Bookkeeper client version 4.16.0. In doing so, we observed new errors related to unexpected reader positions in the passed in byte buffer. Here is a thread discussing some of the observations: https://lists.apache.org/thread/n4dpmbo5t9bvq5t1fp8fn4m6c6d9d9so.
Based on my analysis, it seems that the core issue is with the type of
ByteBufbeing passed to the BK client. Previously, thereaderIndexfor theByteBufthat was passed did not change. Now, it seems to move forward. I am assuming this is because of specific conditions related toCompositeByteBuf, but I haven't yet been able to create a test to show the problem. Perhaps someone is more familiar with these data structures and can provide me with insight into how to test this change?Changes
Update
DigestManager#computeDigestAndPackageForSendingV2in the case of a small entry to use a copy method that does not modify thereaderIndexon the parameterized buffer.Below are the Javadocs for the old and the new method.