Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
dk131072
redis
提交
5a6cfbf4
R
redis
项目概览
dk131072
/
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,发现更多精彩内容 >>
提交
5a6cfbf4
编写于
2月 06, 2020
作者:
G
Guy Benoish
提交者:
antirez
2月 12, 2020
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Some refactroing using getClientType instead of CLIENT_SLAVE
上级
fae306b3
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
18 addition
and
26 deletion
+18
-26
src/networking.c
src/networking.c
+5
-4
src/object.c
src/object.c
+13
-22
未找到文件。
src/networking.c
浏览文件 @
5a6cfbf4
...
@@ -369,9 +369,10 @@ void addReplyErrorLength(client *c, const char *s, size_t len) {
...
@@ -369,9 +369,10 @@ void addReplyErrorLength(client *c, const char *s, size_t len) {
* Where the master must propagate the first change even if the second
* Where the master must propagate the first change even if the second
* will produce an error. However it is useful to log such events since
* will produce an error. However it is useful to log such events since
* they are rare and may hint at errors in a script or a bug in Redis. */
* they are rare and may hint at errors in a script or a bug in Redis. */
if
(
c
->
flags
&
(
CLIENT_MASTER
|
CLIENT_SLAVE
)
&&
!
(
c
->
flags
&
CLIENT_MONITOR
))
{
int
ctype
=
getClientType
(
c
);
char
*
to
=
c
->
flags
&
CLIENT_MASTER
?
"master"
:
"replica"
;
if
(
ctype
==
CLIENT_TYPE_MASTER
||
ctype
==
CLIENT_TYPE_SLAVE
)
{
char
*
from
=
c
->
flags
&
CLIENT_MASTER
?
"replica"
:
"master"
;
char
*
to
=
ctype
==
CLIENT_TYPE_MASTER
?
"master"
:
"replica"
;
char
*
from
=
ctype
==
CLIENT_TYPE_MASTER
?
"replica"
:
"master"
;
char
*
cmdname
=
c
->
lastcmd
?
c
->
lastcmd
->
name
:
"<unknown>"
;
char
*
cmdname
=
c
->
lastcmd
?
c
->
lastcmd
->
name
:
"<unknown>"
;
serverLog
(
LL_WARNING
,
"== CRITICAL == This %s is sending an error "
serverLog
(
LL_WARNING
,
"== CRITICAL == This %s is sending an error "
"to its %s: '%s' after processing the command "
"to its %s: '%s' after processing the command "
...
@@ -1074,7 +1075,7 @@ void freeClient(client *c) {
...
@@ -1074,7 +1075,7 @@ void freeClient(client *c) {
}
}
/* Log link disconnection with slave */
/* Log link disconnection with slave */
if
(
(
c
->
flags
&
CLIENT_SLAVE
)
&&
!
(
c
->
flags
&
CLIENT_MONITOR
)
)
{
if
(
getClientType
(
c
)
==
CLIENT_TYPE_SLAVE
)
{
serverLog
(
LL_WARNING
,
"Connection with replica %s lost."
,
serverLog
(
LL_WARNING
,
"Connection with replica %s lost."
,
replicationGetSlaveName
(
c
));
replicationGetSlaveName
(
c
));
}
}
...
...
src/object.c
浏览文件 @
5a6cfbf4
...
@@ -974,38 +974,29 @@ struct redisMemOverhead *getMemoryOverheadData(void) {
...
@@ -974,38 +974,29 @@ struct redisMemOverhead *getMemoryOverheadData(void) {
mh
->
repl_backlog
=
mem
;
mh
->
repl_backlog
=
mem
;
mem_total
+=
mem
;
mem_total
+=
mem
;
mem
=
0
;
if
(
listLength
(
server
.
slaves
))
{
listIter
li
;
listNode
*
ln
;
listRewind
(
server
.
slaves
,
&
li
);
while
((
ln
=
listNext
(
&
li
)))
{
client
*
c
=
listNodeValue
(
ln
);
mem
+=
getClientOutputBufferMemoryUsage
(
c
);
mem
+=
sdsAllocSize
(
c
->
querybuf
);
mem
+=
sizeof
(
client
);
}
}
mh
->
clients_slaves
=
mem
;
mem_total
+=
mem
;
mem
=
0
;
mem
=
0
;
if
(
listLength
(
server
.
clients
))
{
if
(
listLength
(
server
.
clients
))
{
listIter
li
;
listIter
li
;
listNode
*
ln
;
listNode
*
ln
;
size_t
mem_normal
=
0
,
mem_slaves
=
0
;
listRewind
(
server
.
clients
,
&
li
);
listRewind
(
server
.
clients
,
&
li
);
while
((
ln
=
listNext
(
&
li
)))
{
while
((
ln
=
listNext
(
&
li
)))
{
size_t
mem_curr
=
0
;
client
*
c
=
listNodeValue
(
ln
);
client
*
c
=
listNodeValue
(
ln
);
if
(
c
->
flags
&
CLIENT_SLAVE
&&
!
(
c
->
flags
&
CLIENT_MONITOR
))
int
type
=
getClientType
(
c
);
continue
;
mem_curr
+=
getClientOutputBufferMemoryUsage
(
c
);
mem
+=
getClientOutputBufferMemoryUsage
(
c
);
mem_curr
+=
sdsAllocSize
(
c
->
querybuf
);
mem
+=
sdsAllocSize
(
c
->
querybuf
);
mem_curr
+=
sizeof
(
client
);
mem
+=
sizeof
(
client
);
if
(
type
==
CLIENT_TYPE_SLAVE
)
mem_slaves
+=
mem_curr
;
else
mem_normal
+=
mem_curr
;
}
}
mh
->
clients_slaves
=
mem_slaves
;
mh
->
clients_normal
=
mem_normal
;
mem
=
mem_slaves
+
mem_normal
;
}
}
mh
->
clients_normal
=
mem
;
mem_total
+=
mem
;
mem_total
+=
mem
;
mem
=
0
;
mem
=
0
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录