-
Notifications
You must be signed in to change notification settings - Fork 50
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
Add read from replica round robin to client CMD #315
Add read from replica round robin to client CMD #315
Conversation
(0..4).map(|_| get_listener_on_available_port()).collect(); | ||
let mut primary_responses = std::collections::HashMap::new(); | ||
primary_responses.insert( | ||
"*2\r\n$4\r\nINFO\r\n$11\r\nREPLICATION\r\n".to_string(), |
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.
can we use a parser function to encode the commands into resp protocol, instead of hardcoding it?
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.
what format would you prefer?
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 use the same format (resp), but why dont you use some parser.to_resp(["INFO", "REPLICATION"])?
Dont we have this functionallity in redis-rs parser?
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.
no, only with Value
, which is even more verbose. But if you prefer, I can use Value
.
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 think it would be better (dont they have some easy fuction for vec=>Value and then Value=>resp?? eef).
I think it would make it harder to write tests if each test writer will need to manually encode the expected result to a resp string
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.
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.
doesn't resolve to Value, and doesn't seem significantly less verbose.
|
||
for mock in mocks.iter() { | ||
for _ in 0..3 { | ||
mock.add_response(&cmd, "$3\r\nbar\r\n".to_string()); |
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.
same - can we pass simple response string and let it be parsed to resp inside add_resopnse?
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.
how will we handle complex responses such as arrays?
b479ffb
to
feaa8c6
Compare
@barshaul round |
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.
Approved, some comments
pub(super) fn reconnect(&self) { | ||
{ | ||
pub(super) fn reconnect(&self, force_reconnect: bool) { | ||
if !force_reconnect { |
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 we need to force reconnect?
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.
Because if the client was created in reconnecting state, without force reconnection it will never start the initial reconnect attempt.
feaa8c6
to
664da0e
Compare
5635b36
to
944b2d6
Compare
This is done by adding an initial state for `ReconnectingConnection`, which doesn't block reconnect. Additionally, as per request, moved the call to `reconnect` when creating a disconnected connection into `ReconnectingConnection`.
This is done in order to handle heartbeats.
1b4e066
to
0696e2b
Compare
830cfed
to
321d7b4
Compare
@barshaul pushed some more commits with various fixes needed in order to reduce flakeyness. please review. |
Java: Update implementation for `FUNCTION LOAD`. (#315) * Update implementation for `FUNCTION LOAD`. Signed-off-by: Yury-Fridlyand <yury.fridlyand@improving.com> Co-authored-by: Aaron <69273634+aaron-congo@users.noreply.github.com>
based over https://github.com/barshaul/babushka/pull/306