-
Notifications
You must be signed in to change notification settings - Fork 473
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
Return string instead of output pointer in metadata #1671
Conversation
PragmaTwice
commented
Aug 12, 2023
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 code LGTM, lets wait for CI and asan, since it might introduce memory problem...
src/storage/redis_metadata.cc
Outdated
uint8_t namespace_size = 0; | ||
GetFixed8(&ns_key, &namespace_size); | ||
*ns = ns_key.ToString().substr(0, namespace_size); | ||
Slice ns(ns_key.data(), namespace_size); |
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.
So this is an optimization that return Slice rather than string?
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.
Yeah, here it is unnecessary to return string. And if it is required, users can construct string manually from slice.
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.
LGTM.
👍
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.
LGTM, though it increase the risk of lifetine handling, the patch would improve our style(and make some string copy less)