-
Notifications
You must be signed in to change notification settings - Fork 551
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
MSETNX must not set keys if any of them exists #980
Comments
The Mxxx commands in Garnet are based on non-transactional semantics, i.e. they are treated as a sequence of individual commands. If users need transactional semantics for the entire batch, they can write this as a custom stored procedure. This is documented here (it says We may consider adding an optional |
Yeah, properly supporting requires the transactional semantics, otherwise you get inevitable race conditions (the current implementation is basically a foreach SETNX. One could have a variable set between the SET_Conditional calls after the MSETNX call was issued). The question is which failure mode is more acceptable when not running in 'strict mode'. I suspect 'working per the docs (except the race)' would be more aligned to user expectations? |
It seems the use cases of |
Describe the bug
When msetnx gets several keys and one of them already exists, msetnx still sets the nonexisting keys. The redis page is very clear:
"MSETNX will not perform any operation at all even if just a single key already exists."
https://redis.io/docs/latest/commands/msetnx/
Steps to reproduce the bug
msetnx a 0 b 1
msetnx c 2 a 3
get a => 0
get c => 2
Expected behavior
No response
Screenshots
No response
Release version
No response
IDE
No response
OS version
No response
Additional context
No response
The text was updated successfully, but these errors were encountered: