Repository navigation
Conversation
songgaoye
force-pushed
the
perf/redis-cluster-mget-move
branch
from
November 3, 2026 02:20
4651cd2 to
d664990
Compare
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
The change has an active critical correctness issue that can truncate sufficiently large GET replies, along with an additional efficiency issue in the same construction path.
2 open issues
What changed in this PR
This PR reduces redundant copying in RedisClusterChannel while parsing commands and aggregating Redis MGET replies.
Changes:
- Moves completed
ParsedCommandobjects into the command list. - Moves
MGETsub-replies into the intermediate reply collection. - Moves intermediate replies into the final encoded response.
| File | Description | Review findings |
|---|---|---|
src/brpc/redis_cluster.cpp |
Applies move-based command parsing and MGET reply aggregation. |
Critical (1 vote): The push_back conversion from IOBuf::Movable can truncate sufficiently large GET replies and leave the big-view allocation unmanaged; use a transfer operation that preserves big views. Nit (2 votes): Use emplace_back to avoid materializing and copying a temporary IOBuf. |
Review effort: Lite
| return false; | ||
| } | ||
| values.push_back(sub_result.encoded_reply); | ||
| values.push_back(sub_result.encoded_reply.movable()); |
| return false; | ||
| } | ||
| values.push_back(sub_result.encoded_reply); | ||
| values.push_back(sub_result.encoded_reply.movable()); |
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.


What problem does this PR solve?
Issue Number: resolve
Problem Summary:
RedisClusterChannelmakes avoidable copies while parsing commands andaggregating
MGETreplies:into the final Redis reply, causing redundant
IOBufblock-referenceoperations.
What is changed and the side effects?
Changed:
ParsedCommandobjects into the parsed command list.MGETsub-reply into the intermediate reply vector.Side effects:
Performance effects:
Avoids copying command argument vectors and eliminates two
IOBufblock-reference copy/release cycles per aggregated
MGETelement.Breaking backward compatibility:
None.
Check List: