-
Notifications
You must be signed in to change notification settings - Fork 193
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
Fixes try_execute_command message parsing bug #560
Fixes try_execute_command message parsing bug #560
Conversation
@@ -1291,6 +1295,11 @@ mod test { | |||
// Shard should start out unset | |||
assert_eq!(qr.active_shard, None); | |||
|
|||
// Don't panic when short query eg. ; is sent | |||
let q0 = simple_query(";"); |
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.
Nice! Happy to see test coverage here.
Really nice, thank you. |
@@ -150,9 +151,13 @@ impl QueryRouter { | |||
|| self.pool_settings.sharding_key_regex.is_some() | |||
{ | |||
// Check only the first block of bytes configured by the pool settings | |||
let len = message_cursor.get_i32() as usize; | |||
let seg = cmp::min(len - 5, self.pool_settings.regex_search_limit); |
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.
is this variable unused now?
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.
it's used in the seg calculation. It needs to be read off the cursor to progress the index that it's pointing to
We were double reading the length of the message, this was masked when we had longer queries where we could read those extra bytes without causing an issue. A ruby health check change uncovered that when sending something like
;
as a query we were running into panics because the buffer did not have the expected number of bytes.