-
Notifications
You must be signed in to change notification settings - Fork 876
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
fix(memcached): parsing multi key get command #2122
Conversation
src/facade/memcache_parser.cc
Outdated
s = cur + 1; | ||
} | ||
} | ||
absl::InlinedVector<std::string_view, 32> tokens = absl::StrSplit(tokens_expression, ' '); |
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.
absl::StrSplit will always allocate a vector.
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.
you mean a std::vector
? That means that an InlinedVector
is implicitly converted to std::vector
?
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.
My mistake, it's not.
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.
Good catch. we also have memcache_parser_test where I think it's better to cover these cases.
src/facade/memcache_parser_test.cc
Outdated
TEST_F(MCParserNoreplyTest, LargeGetRequest) { | ||
std::string large_request = "get"; | ||
for (size_t i = 0; i < 100; ++i) { | ||
absl::StrAppend(&large_request, " mykey", i, ","); |
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.
why do you put a comma here?
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.
accidental
} | ||
large_request.pop_back(); | ||
absl::StrAppend(&large_request, "\r\n"); | ||
RunTest(large_request, false); |
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.
you can actually verify what are the keys that are parsed into cmd_
} | ||
large_request.pop_back(); | ||
absl::StrAppend(&large_request, "\r\n"); | ||
RunTest(large_request, false); |
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.
you can actually verify what are the keys that are parsed into cmd_
* remove limit of 8 keys per command * refactor (small) of the parsing logic * add test
addresses #2121