Skip to content
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

Merged
merged 3 commits into from
Nov 6, 2023
Merged

Conversation

kostasrim
Copy link
Contributor

@kostasrim kostasrim commented Nov 3, 2023

addresses #2121

  • remove limit of 8 keys per command
  • refactor (small) of the parsing logic
  • add test

@kostasrim kostasrim self-assigned this Nov 3, 2023
s = cur + 1;
}
}
absl::InlinedVector<std::string_view, 32> tokens = absl::StrSplit(tokens_expression, ' ');
Copy link
Collaborator

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.

Copy link
Contributor Author

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 ?

Copy link
Collaborator

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.

romange
romange previously approved these changes Nov 3, 2023
Copy link
Collaborator

@romange romange left a 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.

TEST_F(MCParserNoreplyTest, LargeGetRequest) {
std::string large_request = "get";
for (size_t i = 0; i < 100; ++i) {
absl::StrAppend(&large_request, " mykey", i, ",");
Copy link
Collaborator

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?

Copy link
Contributor Author

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);
Copy link
Collaborator

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);
Copy link
Collaborator

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_

@kostasrim kostasrim merged commit f68e1ef into main Nov 6, 2023
10 checks passed
@kostasrim kostasrim deleted the fix_memcached branch November 6, 2023 09:27
romange pushed a commit that referenced this pull request Nov 6, 2023
* remove limit of 8 keys per command
* refactor (small) of the parsing logic
* add test
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants