-
Notifications
You must be signed in to change notification settings - Fork 1.1k
feat(Server):support Verbatim strings resp type, using it for CLIENT LIST and INFO commands #2264
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
Conversation
src/facade/reply_builder.cc
Outdated
DVLOG(1) << "Unknown verbatim reply format: " << format; | ||
return; | ||
} | ||
iovec v[4] = {IoVec(lenpref), IoVec(format_str), IoVec(str), IoVec(kCRLF)}; |
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.
there is a small preference to reduce number of vectors (it's more efficient).
Therefore, I suggest to increase tmp
buffer size to accommodate the format prefix as well.
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.
ok, done.
Signed-off-by: Yue Li <[email protected]>
if (!is_resp3_) | ||
return SendBulkString(str); | ||
|
||
char tmp[absl::numbers_internal::kFastToBufferSize + 7]; |
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.
Nit: if you use std::array
you'll get out-of-bound checks in debug runs (plus .size()
instead of ABSL_ARRAYSIZE
)
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 will keep the raw array to be consistent with other places...
fixes #2242 #2253
Reference:
The definition of Redis verbatim strings: https://redis.io/docs/reference/protocol-spec/#verbatim-strings
"For example, the Redis command INFO outputs a report that includes newlines. When using RESP3, redis-cli displays it correctly because it is sent as a Verbatim String reply (with its three bytes being "txt"). When using RESP2, however, the redis-cli is hard-coded to look for the INFO command to ensure its correct display to the user."