You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Originally posted by suxb201 October 30, 2024
How can we ensure the atomicity between WATCH and EXEC?
WATCH k1
MULTI
SET k2 v2
EXEC
When k1 is modified, the current conn context's watched_dirty flag is set to true. If watched_dirty is false, EXEC will begin execution. However, how can we ensure that the check of this flag and the execution of the transaction itself are atomic?
In other words, there is a potential issue where k1 could be modified during the EXEC execution, or k1 could be modified just before EXEC is executed and after the flag is checked.
You are right, the implementation of this feature is indeed lacks the atomicity guarantees. The right way to do it would be to check if something is modified during the schedule phase of MULTI transaction, when run locally on the shard thread.
Discussed in #4015
Originally posted by suxb201 October 30, 2024
How can we ensure the atomicity between WATCH and EXEC?
When k1 is modified, the current conn context's
watched_dirty
flag is set to true. Ifwatched_dirty
is false, EXEC will begin execution. However, how can we ensure that the check of this flag and the execution of the transaction itself are atomic?In other words, there is a potential issue where k1 could be modified during the EXEC execution, or k1 could be modified just before EXEC is executed and after the flag is checked.
#4015 (comment)
The text was updated successfully, but these errors were encountered: