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

chore: more parser improvements #4177

Merged
merged 1 commit into from
Nov 25, 2024
Merged

chore: more parser improvements #4177

merged 1 commit into from
Nov 25, 2024

Conversation

romange
Copy link
Collaborator

@romange romange commented Nov 24, 2024

The long-term goal is to make the parser to consume the whole input when
it returns INPUT_PENDING. It requires several baby step PRs.

This PR:

  1. Adds more invariant checks
  2. Avoids calling RedisParser::Parse with an empty buffer.
  3. In bulk string parsing - remove redundant "optimization" of rejecting partial strings of less than 32 bytes,
    in other words consume small parts as well. The unit test adjusted accordingly.

The long-term goal is to make the parser to consume the whole input when
it returns INPUT_PENDING. It requires several baby step PRs.

This PR:
1. Adds more invariant checks
2. Avoids calling RedisParser::Parse with an empty buffer.
3. In bulk string parsing - remove redundant "optimization" of rejecting partial strings of less than 32 bytes,
   in other words consume small parts as well. The unit test adjusted accordingly.

Signed-off-by: Roman Gershman <[email protected]>
ASSERT_EQ(RedisParser::INPUT_PENDING, Parse(kFirst));
ASSERT_EQ(strlen(kFirst) - 4, consumed_);
ASSERT_EQ(strlen(kFirst), consumed_);
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the only functional change of this PR: we now consume the small part of a bulk string. In this case key:.

@romange romange requested a review from BorysTheDev November 25, 2024 06:47
@romange romange merged commit 872d5e2 into main Nov 25, 2024
12 of 14 checks passed
@romange romange deleted the Pr1 branch November 25, 2024 07:15
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.

2 participants