-
Notifications
You must be signed in to change notification settings - Fork 702
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
Nested MULTI or WATCH in MULTI now will abort the transaction #723
Conversation
Currently, for nested multi or executing watch in multi, we will return an error but we will not abort the transaction. ``` 127.0.0.1:6379> multi OK 127.0.0.1:6379(TX)> multi (error) ERR MULTI calls can not be nested127.0.0.1:6379(TX)> set key value QUEUED 127.0.0.1:6379(TX)> exec 1) OK 127.0.0.1:6379> multi OK 127.0.0.1:6379(TX)> watch key (error) ERR WATCH inside MULTI is not allowed 127.0.0.1:6379(TX)> set key value QUEUED 127.0.0.1:6379(TX)> exec 1) OK ``` In theory, this is also a syntax error, an unexpected behavior should abort the transaction. Add the NO_MULTI flag to them so that they will be rejected in processCommand and rejectCommand will abort the transaction. Signed-off-by: Binbin <[email protected]>
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## unstable #723 +/- ##
============================================
- Coverage 70.25% 70.12% -0.14%
============================================
Files 111 111
Lines 60242 60236 -6
============================================
- Hits 42326 42240 -86
- Misses 17916 17996 +80
|
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 agree.
So there are two visible changes:
- Different words in the error messages
- Exec returns error
@madolson Let's merge it? @enjoy-binbin Can you edit the title to focus on the visible difference for the users? |
I'm ok merging it. |
@zuiderkwast please take a look, you can fix it if necessary (i am not really good at it.) |
Hehe, it's good! 😄 |
Currently, for nested MULTI or executing WATCH in MULTI, we will return
an error but we will not abort the transaction.
This is an unexpected behavior that should abort the transaction.
The number of elements returned by EXEC also doesn't match the number
of commands in MULTI.
Add the NO_MULTI flag to them so that they will
be rejected in processCommand and rejectCommand will abort the transaction.
So there are two visible changes: