-
Notifications
You must be signed in to change notification settings - Fork 1k
Write race condition while migrating/importing a slot #1218
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
Comments
Thanks for report. There's indeed a loophole that allows sending unrelated commands between |
mp911de
added a commit
that referenced
this issue
Feb 10, 2020
When encountering an ASK redirect, Lettuce now sends atomically both commands, ASKING and the redirected command, to avoid race conditions due to interleaved commands.
mp911de
added a commit
that referenced
this issue
Feb 10, 2020
When encountering an ASK redirect, Lettuce now sends atomically both commands, ASKING and the redirected command, to avoid race conditions due to interleaved commands.
mp911de
added a commit
that referenced
this issue
Feb 10, 2020
When encountering an ASK redirect, Lettuce now sends atomically both commands, ASKING and the redirected command, to avoid race conditions due to interleaved commands.
That's fixed now. |
Thank you for the fix. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Bug Report
Current Behavior
While a slot with a lot of data is being migrated from one master M1 to another master M2, the slot will be in MIGRATING state in M1 and IMPORTING state in M2 for sometime due to the large amount of data being copied.
During this state, when a command C1 was sent to M1 and M1 reply with ASK M2, lettuce might not send ASKING immediately followed by C1 to M2. In this scenario, the client will be bounced back and forth between M1 and M2 until ASKING + C1 are sent consecutively to M2 or the maxRedirect count is reached. In the example below, we can see that the client is sending other commands between ASKING and C1.
The probability of the above scenario happening increases with the amount of data in the slot and the QPS the client is handling. The symptom can be alleviated by increasing the maxRedirect count as this gives lettuce more retries to get ASKING + C1 commands sent consecutively.
Traces
Offending Key: rct--287151481
slot being moved: 441
tcpflow trace on M1
tcpflow trace on M2
Input Code
Input Code
Benchmark.java
Expected behavior/code
The command C1 above should immediately follow the "ASKING" request. Please see redis doc for more details.
Environment
Possible Solution
Additional context
The text was updated successfully, but these errors were encountered: