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
Adding new feature to pipeline.execute() so it can optionally add
multi-exec around consecutive redis commands that are for the same
slot. Redis cluster does not support multi-exec for different slots,
even if the slots are on the same shard.
This feature provides limited support (*1) of atomic transaction using
multi-exec on redis cluster.
Step1: add optional arg use_multi=False to pipeline.execute(), so the
default behavior is what it used to be. ie. this feature is off by
default.
*1: limited support: only for consecutive commands in pipeline for the
same slot. eg. for commands
incr a{1} #1
decr b{1} #2
incr a{2} #3
decr b{2} #4
incr a{3} Grokzen#5
Since #1,#2 are for the same slot, we will add multi-exec around them
(multi before #1, and exec after #2). #3,#4 are in their own one
slot, but different from that of #1,#2, so another set of multi-exec.
Grokzen#5 is in its own slot, no multi-exec added.
Thus the commands sent to the cluster are:
multi
incr a{1} #1
decr b{1} #2
exec
multi
incr a{2} #3
decr b{2} #4
exec
incr a{3} Grokzen#5
The result of the added multi-exec are stripped from the response, so
the client will see no change in response format.
0 commit comments