-
Notifications
You must be signed in to change notification settings - Fork 981
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: parser cleanups #4076
base: main
Are you sure you want to change the base?
chore: parser cleanups #4076
Conversation
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
src/facade/redis_parser.cc
Outdated
InitStart(str[0], res); | ||
} | ||
DCHECK(state_ != CMD_COMPLETE_S); |
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 had to check this. InitStart
does update state_
if it's equal CMD_COMPLETE_S
so it's fine.
src/facade/redis_parser.cc
Outdated
if (pos[-1] != '\r') { | ||
return BAD_INT; | ||
|
||
consumed = pos - s + 1; |
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 am blindly trusting you here. I haven;t checked the index calculations but the tests are failing and it's a sign that there is a mistake somewhere around here 😄
Tests are failing :) |
759f1e7
to
93682c7
Compare
dbf8419
to
6ce0516
Compare
e84c303
to
b788c86
Compare
63a3bf1
to
f7fa90c
Compare
@romange still not green |
And I still have not requested to review :) |
Uhhh I saw the notification and saw you asked 😄 nvm |
ae13a73
to
002d26d
Compare
1. Separate argument type parsing from argument parsing itself. 2. Handle strings of length 1. This is done in preparation of improving the parser contract - so that when it returns INPUT_PENDING, it consumes the entire input. Signed-off-by: Roman Gershman <[email protected]>
This is needed in order to eliminate cases where we return INPUT_PENDING but do not consume the whole string by rejecting just several bytes. This should simplify buffer management for the caller, so that if they pass a string that did not result in complete parsed request, at least the whole string is consumed and can be discarded. Signed-off-by: Roman Gershman <[email protected]>
Also, eliminate cases where we return INPUT_PENDING but do not consume the whole string. This should simplify buffer management for the caller, so that if they pass a string that did not result in complete parsed request, at least the whole string is consumed and can be discarded.
This PR handles only the ParseLen function that now stashes all the partial data if not enough data is provided.