Skip to content
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

Support Cross-slot command execution in Cluster #673

Open
1 of 18 tasks
anatolysergeev opened this issue Nov 12, 2022 · 0 comments
Open
1 of 18 tasks

Support Cross-slot command execution in Cluster #673

anatolysergeev opened this issue Nov 12, 2022 · 0 comments
Assignees
Labels
enhancement New feature or request

Comments

@anatolysergeev
Copy link
Collaborator

anatolysergeev commented Nov 12, 2022

We can add support for some commands like it's been done in lettuce

Regular Redis Cluster commands are limited to single-slot keys operation – either single key commands or multi-key commands that share the same hash slot.

  • Commands without a key are executed on the default connection that points most likely to the first provided RedisURI. The same rule applies to commands operating on multiple keys but with the limitation that all keys have to be in the same slot.

The cross slot limitation can be mitigated by using the advanced cluster API for a set of selected multi-key commands. Commands that operate on keys with different slots are decomposed into multiple commands. The single commands are fired in a fork/join fashion. The commands are issued concurrently to avoid synchronous chaining. Results are synchronized before the command is completed.

Following commands can be supported for cross-slot command execution:

  • DEL: Delete the KEYs. Returns the number of keys that were removed.
  • EXISTS: Count the number of KEYs that exist across the master nodes being responsible for the particular key.
  • MGET: Get the values of all given KEYs. Returns the values in the order of the keys.
  • MSET: Set multiple key/value pairs for all given KEYs. Returns always OK.
  • TOUCH: Alters the last access time of all given KEYs. Returns the number of keys that were touched.
  • UNLINK: Delete the KEYs and reclaiming memory in a different thread. Returns the number of keys that were removed.

Following commands can be executed on multiple cluster nodes operations:

  • CLIENT SETNAME: Set the client name on all known cluster node connections. Returns always OK.
  • KEYS: Return/Stream all keys that are stored on all masters.
  • DBSIZE: Return the number of keys that are stored on all masters.
  • FLUSHALL: Flush all data on the cluster masters. Returns always OK.
  • FLUSHDB: Flush all data on the cluster masters. Returns always OK.
  • RANDOMKEY: Return a random key from a random master.
  • SCAN: Scan the keyspace across the whole cluster according to ReadFrom settings.
  • SCRIPT FLUSH: Remove all the scripts from the script cache on all cluster nodes.
  • SCRIPT LOAD: Load the script into the Lua script cache on all nodes.
  • SCRIPT KILL: Kill the script currently in execution on all cluster nodes. This call does not fail even if no scripts are running.
  • SHUTDOWN: Synchronously save the dataset to disk and then shut down all nodes of the cluster.
@anatolysergeev anatolysergeev added the enhancement New feature or request label Nov 12, 2022
@anatolysergeev anatolysergeev changed the title Support Cross-slot command execution Support Cross-slot command execution in Cluster Nov 12, 2022
@anatolysergeev anatolysergeev self-assigned this Nov 12, 2022
anatolysergeev added a commit to anatolysergeev/zio-redis that referenced this issue Feb 9, 2023
…y commands with the limitation that all keys have to be in the same slot

zio#673
anatolysergeev added a commit to anatolysergeev/zio-redis that referenced this issue Feb 12, 2023
anatolysergeev added a commit to anatolysergeev/zio-redis that referenced this issue Feb 12, 2023
…y commands with the limitation that all keys have to be in the same slot

zio#673
anatolysergeev added a commit to anatolysergeev/zio-redis that referenced this issue Feb 12, 2023
anatolysergeev added a commit to anatolysergeev/zio-redis that referenced this issue Feb 12, 2023
anatolysergeev added a commit to anatolysergeev/zio-redis that referenced this issue Feb 12, 2023
anatolysergeev added a commit to anatolysergeev/zio-redis that referenced this issue Feb 12, 2023
anatolysergeev added a commit to anatolysergeev/zio-redis that referenced this issue Feb 24, 2023
@mijicd mijicd added this to the 0.4.0 milestone Apr 6, 2023
@mijicd mijicd removed this from the 0.4.0 milestone Sep 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants