Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Turbo码先生
redis
提交
7c29c9ee
R
redis
项目概览
Turbo码先生
/
redis
与 Fork 源项目一致
从无法访问的项目Fork
通知
1
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,发现更多精彩内容 >>
提交
7c29c9ee
编写于
4月 29, 2020
作者:
A
antirez
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
redis-cli: simplify cluster nodes coverage display.
上级
86a1386d
变更
1
显示空白变更内容
内联
并排
Showing
1 changed file
with
10 addition
and
17 deletion
+10
-17
src/redis-cli.c
src/redis-cli.c
+10
-17
未找到文件。
src/redis-cli.c
浏览文件 @
7c29c9ee
...
...
@@ -4295,17 +4295,18 @@ static int clusterManagerGetCoveredSlots(char *all_slots) {
}
static
void
clusterManagerPrintSlotsList
(
list
*
slots
)
{
clusterManagerNode
n
=
{
0
};
listIter
li
;
listNode
*
ln
;
listRewind
(
slots
,
&
li
);
sds
first
=
NULL
;
while
((
ln
=
listNext
(
&
li
))
!=
NULL
)
{
sds
slot
=
ln
->
value
;
if
(
!
first
)
first
=
slot
;
else
printf
(
", "
);
printf
(
"%s"
,
slot
);
int
slot
=
atoi
(
ln
->
value
);
if
(
slot
>=
0
&&
slot
<
CLUSTER_MANAGER_SLOTS
)
n
.
slots
[
slot
]
=
1
;
}
printf
(
"
\n
"
);
sds
nodeslist
=
clusterManagerNodeSlotsString
(
&
n
);
printf
(
"%s
\n
"
,
nodeslist
);
sdsfree
(
nodeslist
);
}
/* Return the node, among 'nodes' with the greatest number of keys
...
...
@@ -4398,15 +4399,10 @@ static int clusterManagerFixSlotsCoverage(char *all_slots) {
int
i
,
fixed
=
0
;
list
*
none
=
NULL
,
*
single
=
NULL
,
*
multi
=
NULL
;
clusterManagerLogInfo
(
">>> Fixing slots coverage...
\n
"
);
printf
(
"List of not covered slots:
\n
"
);
int
uncovered_count
=
0
;
sds
log
=
sdsempty
();
for
(
i
=
0
;
i
<
CLUSTER_MANAGER_SLOTS
;
i
++
)
{
int
covered
=
all_slots
[
i
];
if
(
!
covered
)
{
sds
key
=
sdsfromlonglong
((
long
long
)
i
);
if
(
uncovered_count
++
>
0
)
printf
(
","
);
printf
(
"%s"
,
(
char
*
)
key
);
sds
slot
=
sdsfromlonglong
((
long
long
)
i
);
list
*
slot_nodes
=
listCreate
();
sds
slot_nodes_str
=
sdsempty
();
listIter
li
;
...
...
@@ -4433,13 +4429,11 @@ static int clusterManagerFixSlotsCoverage(char *all_slots) {
}
freeReplyObject
(
reply
);
}
log
=
sdscatfmt
(
log
,
"
\n
Slot %S has keys in %u nodes: %S"
,
key
,
listLength
(
slot_nodes
),
slot_nodes_str
);
sdsfree
(
slot_nodes_str
);
dictAdd
(
clusterManagerUncoveredSlots
,
key
,
slot_nodes
);
dictAdd
(
clusterManagerUncoveredSlots
,
slot
,
slot_nodes
);
}
}
printf
(
"
\n
%s
\n
"
,
log
);
/* For every slot, take action depending on the actual condition:
* 1) No node has keys for this slot.
* 2) A single node has keys for this slot.
...
...
@@ -4581,7 +4575,6 @@ static int clusterManagerFixSlotsCoverage(char *all_slots) {
}
}
cleanup:
sdsfree
(
log
);
if
(
none
)
listRelease
(
none
);
if
(
single
)
listRelease
(
single
);
if
(
multi
)
listRelease
(
multi
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录