redis-rb icon indicating copy to clipboard operation
redis-rb copied to clipboard

UNWATCH for redis cluster

Open mdimas opened this issue 5 years ago • 1 comments

Since watch takes a keys(s) it appears to be supported on redis cluster, but unwatch raises an AmbiguousNodeError since there is no key specified. Is there a reason why unwatch could not be implemented to get called on all nodes?

mdimas avatar Nov 02 '20 19:11 mdimas

Hello,

I think that there is a performance issue if cluster has thousand of nodes. But certainly we can send the command to all nodes without errors.

https://github.com/redis/redis-rb/blob/087a11b585978cd3970d22d066b7d8ccd89a40f6/lib/redis/cluster.rb#L148-L149

In client-side-distributed feature case, we can use unwatch command if we specified keys by watch command.

https://github.com/redis/redis-rb/blob/69ce376d2bc18d60ea650c44d36db61dac16ff63/lib/redis/distributed.rb#L805-L826

Also, redis-cluster-proxy supports unwatch command.

UNWATCH (disables multiplexing)

https://github.com/RedisLabs/redis-cluster-proxy/blob/f8dc227a07f4a738b5fd211501bd521f32f1fcbd/COMMANDS.md

So it seems that there is room for improvement for cluster mode in our gem.

https://github.com/redis/redis-rb/blob/087a11b585978cd3970d22d066b7d8ccd89a40f6/test/cluster_commands_on_transactions_test.rb#L28-L32

supercaracal avatar Nov 03 '20 02:11 supercaracal