util/encoding: support deep copying when decoding bytes ascending#70740
Merged
craig[bot] merged 1 commit intocockroachdb:masterfrom Sep 27, 2021
Merged
util/encoding: support deep copying when decoding bytes ascending#70740craig[bot] merged 1 commit intocockroachdb:masterfrom
craig[bot] merged 1 commit intocockroachdb:masterfrom
Conversation
Member
There is an optimization when decoding bytes ascending when it might return the decoded value that shares the same storage as the input buffer. However, this optimization might not be desirable in all cases: in particular, if the input buffer came from the large BatchResponse, then the decoded value might keep that whole response from being GCed. This commit adds a couple of methods to avoid using the shared storage by always performing a deep copy. It also audits all callers of the relevant methods on the KV-SQL boundary (the fetchers) to make sure they perform the deep copy when needed. Release note: None
af3a79b to
4b2f115
Compare
mgartner
approved these changes
Sep 27, 2021
Contributor
mgartner
left a comment
There was a problem hiding this comment.
Reviewed 3 of 3 files at r1, all commit messages.
Reviewable status:complete! 1 of 0 LGTMs obtained (waiting on @yuzefovich)
Member
Author
|
TFTR! bors r+ |
Contributor
|
Build succeeded: |
craig bot
pushed a commit
that referenced
this pull request
Nov 18, 2021
70768: release-21.2: util/encoding: support deep copying when decoding bytes ascending r=yuzefovich a=blathers-crl[bot] Backport 1/1 commits from #70740 on behalf of @yuzefovich. /cc @cockroachdb/release ---- There is an optimization when decoding bytes ascending when it might return the decoded value that shares the same storage as the input buffer. However, this optimization might not be desirable in all cases: in particular, if the input buffer came from the large BatchResponse, then the decoded value might keep that whole response from being GCed. This commit adds a couple of methods to avoid using the shared storage by always performing a deep copy. It also audits all callers of the relevant methods on the KV-SQL boundary (the fetchers) to make sure they perform the deep copy when needed. Release note: None ---- Release justification: 72253: release-21.2: coldata: fix BenchmarkAppend so that it could be run with multiple count r=yuzefovich a=blathers-crl[bot] Backport 1/1 commits from #72132 on behalf of @yuzefovich. /cc @cockroachdb/release ---- Previously, we could get an index out of bounds because we'd allocate larger `Bytes.data` slice than `int32` offset can support. Release note: None ---- Release justification: Co-authored-by: Yahor Yuzefovich <yahor@cockroachlabs.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
There is an optimization when decoding bytes ascending when it might
return the decoded value that shares the same storage as the input
buffer. However, this optimization might not be desirable in all cases:
in particular, if the input buffer came from the large BatchResponse,
then the decoded value might keep that whole response from being GCed.
This commit adds a couple of methods to avoid using the shared storage
by always performing a deep copy. It also audits all callers of the
relevant methods on the KV-SQL boundary (the fetchers) to make sure they
perform the deep copy when needed.
Release note: None