Skip to content
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(pilota)/use advance method to align the inner buffer index with the protocol index when feasible #247

Merged
merged 5 commits into from
May 27, 2024

Conversation

Ggiggle
Copy link
Contributor

@Ggiggle Ggiggle commented May 27, 2024

Motivation

The inner buffer index might not align with the index of protocol for better performance of vector encoding or decoding. Thus, when we use the buf or buf_mut interface which return the inner buffer, we might encounter the issue of reading or writing at wrong position of the buffer.

Solution

As there are some low frequency option, such as read_message_begin, which are not pursuing performance, we can use the advance and advance_mut method to align the inner buffer index with the index of protocol implement. Then, we can get the right payload after read_message_begin.

As a reminder, this PR cannot completely resolve the inconsistency problem of these two indexes, so be careful of using the buf and buf_mut in the middle of processing the thrift message.

@Ggiggle Ggiggle requested review from a team as code owners May 27, 2024 12:36
PureWhiteWu
PureWhiteWu previously approved these changes May 27, 2024
@Ggiggle Ggiggle merged commit cae3cde into main May 27, 2024
10 checks passed
@Ggiggle Ggiggle deleted the fix/input_proto_advance branch May 27, 2024 13:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants