-
Notifications
You must be signed in to change notification settings - Fork 687
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Nested MULTI or WATCH in MULTI now will abort the transaction (#723)
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 nested 127.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 ``` 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: - Different words in the error messages. (Command not allowed inside a transaction) - Exec returns error. Signed-off-by: Binbin <[email protected]>
- Loading branch information
1 parent
2d6791b
commit 6bf1d02
Showing
5 changed files
with
10 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,6 +11,7 @@ | |
"LOADING", | ||
"STALE", | ||
"FAST", | ||
"NO_MULTI", | ||
"ALLOW_BUSY" | ||
], | ||
"acl_categories": [ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,6 +11,7 @@ | |
"LOADING", | ||
"STALE", | ||
"FAST", | ||
"NO_MULTI", | ||
"ALLOW_BUSY" | ||
], | ||
"acl_categories": [ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters