[fix] DigestManager should not advance readerIndex#3919
[fix] DigestManager should not advance readerIndex#3919eolivelli merged 1 commit intoapache:masterfrom
Conversation
eolivelli
left a comment
There was a problem hiding this comment.
Great catch!
@hangc0276 this is a bad regression we should cut a new release ASAP
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.