From 964cd99e7af8afe7a2dde9a373a42ba0721aac54 Mon Sep 17 00:00:00 2001 From: asahi Date: Tue, 30 Sep 2025 15:06:56 +0800 Subject: [PATCH] =?UTF-8?q?doc:=20=E9=98=85=E8=AF=BBredis=20multi-key=20op?= =?UTF-8?q?erations=E7=9A=84=E6=96=87=E6=A1=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 中间件/redis/redis.md | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/中间件/redis/redis.md b/中间件/redis/redis.md index 94a9203..3f7d027 100644 --- a/中间件/redis/redis.md +++ b/中间件/redis/redis.md @@ -224,6 +224,7 @@ - [ASK redirection](#ask-redirection) - [Client connections and redirection handling](#client-connections-and-redirection-handling) - [CLUSTER SLOTS](#cluster-slots) + - [Multi-keys operations](#multi-keys-operations) # redis @@ -3574,6 +3575,14 @@ client可以发送`CLUSTER SLOTS`命令来获取`an array of slot ranges and ass 当slot发现为unassigned时,在向调用方返回异常之前,client会尝试拉取slots configuration,并且校验cluster当前是否被正确配置。 +#### Multi-keys operations +在使用`hash tags`时,client可以在集群访问下进行multi-key operations,示例如下: +```redis-cli +MSET {user:1000}.name Angela {user:1000}.surname White +``` +但是,在key所属的slot正在进行`resharding`时,`multi-key` operations有可能无法被执行: +- 当resharding过程中,对于`multi-key operations`,如果targeting keys都存在,并且被hash到相同的slot中(都位于source或destination node`中),那么该multi-keys operation是可执行的 +- `如果targeting keys不存在,或者在resharding过程中在source node和destination node中都存在`,那么将会发生一个`TRYAGAIN` error,client可以在后续对该操作进行重试,或报告该error - +当指定hash slots的迁移完成后,关于该hash slot所有的`multi-key operations`都允许被执行。