Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
别团等shy哥发育
redis
提交
6856c7b4
R
redis
项目概览
别团等shy哥发育
/
redis
与 Fork 源项目一致
从无法访问的项目Fork
通知
2
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
R
redis
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
6856c7b4
编写于
10月 17, 2011
作者:
A
antirez
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
First implementation of the ASKING command. Semantics still to verify.
上级
e0aab1fc
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
23 addition
and
2 deletion
+23
-2
src/cluster.c
src/cluster.c
+18
-2
src/networking.c
src/networking.c
+2
-0
src/redis.c
src/redis.c
+1
-0
src/redis.h
src/redis.h
+2
-0
未找到文件。
src/cluster.c
浏览文件 @
6856c7b4
...
...
@@ -1657,6 +1657,19 @@ void dumpCommand(redisClient *c) {
return
;
}
/* The ASKING command is required after a -ASK redirection.
* The client should issue ASKING before to actualy send the command to
* the target instance. See the Redis Cluster specification for more
* information. */
void
askingCommand
(
redisClient
*
c
)
{
if
(
server
.
cluster_enabled
==
0
)
{
addReplyError
(
c
,
"This instance has cluster support disabled"
);
return
;
}
c
->
flags
|=
REDIS_ASKING
;
addReply
(
c
,
shared
.
ok
);
}
/* -----------------------------------------------------------------------------
* Cluster functions related to serving / redirecting clients
* -------------------------------------------------------------------------- */
...
...
@@ -1750,9 +1763,12 @@ clusterNode *getNodeByQuery(redisClient *c, struct redisCommand *cmd, robj **arg
}
/* Handle the case in which we are receiving this hash slot from
* another instance, so we'll accept the query even if in the table
* it is assigned to a different node. */
if
(
server
.
cluster
.
importing_slots_from
[
slot
]
!=
NULL
)
* it is assigned to a different node, but only if the client
* issued an ASKING command before. */
if
(
server
.
cluster
.
importing_slots_from
[
slot
]
!=
NULL
&&
c
->
flags
&
REDIS_ASKING
)
{
return
server
.
cluster
.
myself
;
}
/* It's not a -ASK case. Base case: just return the right node. */
return
n
;
}
src/networking.c
浏览文件 @
6856c7b4
...
...
@@ -625,6 +625,8 @@ void resetClient(redisClient *c) {
c
->
reqtype
=
0
;
c
->
multibulklen
=
0
;
c
->
bulklen
=
-
1
;
/* We clear the ASKING flag as well if we are not inside a MULTI. */
if
(
!
(
c
->
flags
&
REDIS_MULTI
))
c
->
flags
&=
(
~
REDIS_ASKING
);
}
void
closeTimedoutClients
(
void
)
{
...
...
src/redis.c
浏览文件 @
6856c7b4
...
...
@@ -209,6 +209,7 @@ struct redisCommand redisCommandTable[] = {
{
"cluster"
,
clusterCommand
,
-
2
,
"ar"
,
0
,
NULL
,
0
,
0
,
0
,
0
,
0
},
{
"restore"
,
restoreCommand
,
4
,
"awm"
,
0
,
NULL
,
1
,
1
,
1
,
0
,
0
},
{
"migrate"
,
migrateCommand
,
6
,
"aw"
,
0
,
NULL
,
0
,
0
,
0
,
0
,
0
},
{
"asking"
,
askingCommand
,
1
,
"r"
,
0
,
NULL
,
0
,
0
,
0
,
0
,
0
},
{
"dump"
,
dumpCommand
,
2
,
"ar"
,
0
,
NULL
,
0
,
0
,
0
,
0
,
0
},
{
"object"
,
objectCommand
,
-
2
,
"r"
,
0
,
NULL
,
0
,
0
,
0
,
0
,
0
},
{
"client"
,
clientCommand
,
-
2
,
"ar"
,
0
,
NULL
,
0
,
0
,
0
,
0
,
0
},
...
...
src/redis.h
浏览文件 @
6856c7b4
...
...
@@ -133,6 +133,7 @@
#define REDIS_UNBLOCKED 256
/* This client was unblocked and is stored in
server.unblocked_clients */
#define REDIS_LUA_CLIENT 512
/* This is a non connected client used by Lua */
#define REDIS_ASKING 1024
/* Client issued the ASKING command */
/* Client request types */
#define REDIS_REQ_INLINE 1
...
...
@@ -1121,6 +1122,7 @@ void unwatchCommand(redisClient *c);
void
clusterCommand
(
redisClient
*
c
);
void
restoreCommand
(
redisClient
*
c
);
void
migrateCommand
(
redisClient
*
c
);
void
askingCommand
(
redisClient
*
c
);
void
dumpCommand
(
redisClient
*
c
);
void
objectCommand
(
redisClient
*
c
);
void
clientCommand
(
redisClient
*
c
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录