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.
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
buffer: improve read reservations to efficiently handle multiple slices #14054
buffer: improve read reservations to efficiently handle multiple slices #14054
Changes from all commits
9c5199f
246f167
ae815f1
6adeeab
6af8023
c8c9cce
a0b68b7
ff13426
c0661eb
0416701
6e9f1aa
eb3fe0e
aff7e53
508d4dc
abcbe9e
be6a9a3
11a4362
532edbb
53fbc33
4bef236
efd8057
75278b6
e56585c
fc7b592
45e7353
5885132
675cd59
a1e6c3e
0e80aca
a5deffa
dc4d618
7bd544a
4e0331d
b4c8e46
112e3bd
6195334
3475f1d
f8d2a72
01e6ebd
1e20eeb
d3559f8
54d0162
c837704
530e045
873f6be
0c92529
2cfd939
0c26ceb
07a9314
6bc1fc3
9f3a717
ef66dc4
47d7cfd
ea5e975
4a92b7d
97bd65b
7b94c6f
180ab4b
875e8d3
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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.
Does the default move constructor work for this class?
I looked at the implementation of absl::InlinedVector's move constructor and I see it sets the size of the original to 0 in cases where inlined storage is used (good).
The buffer_ and length_ are still set to their original values after the move. I guess that's probably fine.
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.
@asraa One thing about ENVOY_BUG is that it should be tested.
The behavior of OwnedImpl::commit when length is larger than the reservation seems well defined (good).
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.
Is the situation here that it's safe to have
length > length_
? Trying to understand why one condition isENVOY_BUG
and the other isASSERT
.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.
Both conditions are the same,
length
must be less than or equal tolength_
, the change just moved it from ASSERT to ENVOY_BUG.(Maybe the semantics of ENVOY_BUG are confusing? ENVOY_BUG(condition, msg) is an error if condition was false, just like ASSERT(condition)).
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.
I made it ENVOY_BUG instead of ASSERT because this condition MAY mean that the caller thought they were committing more bytes than they actually commit, which MAY mean the data in the buffer is now not what the caller expected (a pretty serious bug). However,
commit()
will keep the data structure in a sane/safe state, so RELEASE_ASSERT seemed over-zealous.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.
The bytes committed is min(length, length_). Tests verify that this case is handled gracefully.
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.
Got it, thanks for the followup. Just trying to be clear on the use of
ASSERT
andENVOY_BUG
in this situation.