Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Turbo码先生
redis
提交
6a16a636
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,发现更多精彩内容 >>
提交
6a16a636
编写于
5月 28, 2020
作者:
A
antirez
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Replication: showLatestBacklog() refactored out.
上级
484af8ed
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
36 addition
and
25 deletion
+36
-25
src/networking.c
src/networking.c
+1
-25
src/replication.c
src/replication.c
+34
-0
src/server.h
src/server.h
+1
-0
未找到文件。
src/networking.c
浏览文件 @
6a16a636
...
...
@@ -396,31 +396,7 @@ void addReplyErrorLength(client *c, const char *s, size_t len) {
if
(
ctype
==
CLIENT_TYPE_MASTER
&&
server
.
repl_backlog
&&
server
.
repl_backlog_histlen
>
0
)
{
long
long
dumplen
=
256
;
if
(
server
.
repl_backlog_histlen
<
dumplen
)
dumplen
=
server
.
repl_backlog_histlen
;
/* Identify the first byte to dump. */
long
long
idx
=
(
server
.
repl_backlog_idx
+
(
server
.
repl_backlog_size
-
dumplen
))
%
server
.
repl_backlog_size
;
/* Scan the circular buffer to collect 'dumplen' bytes. */
sds
dump
=
sdsempty
();
while
(
dumplen
)
{
long
long
thislen
=
((
server
.
repl_backlog_size
-
idx
)
<
dumplen
)
?
(
server
.
repl_backlog_size
-
idx
)
:
dumplen
;
dump
=
sdscatrepr
(
dump
,
server
.
repl_backlog
+
idx
,
thislen
);
dumplen
-=
thislen
;
idx
=
0
;
}
/* Finally log such bytes: this is vital debugging info to
* understand what happened. */
serverLog
(
LL_WARNING
,
"Latest backlog is: '%s'"
,
dump
);
sdsfree
(
dump
);
showLatestBacklog
();
}
server
.
stat_unexpected_error_replies
++
;
}
...
...
src/replication.c
浏览文件 @
6a16a636
...
...
@@ -307,6 +307,40 @@ void replicationFeedSlaves(list *slaves, int dictid, robj **argv, int argc) {
}
}
/* This is a debugging function that gets called when we detect something
* wrong with the replication protocol: the goal is to peek into the
* replication backlog and show a few final bytes to make simpler to
* guess what kind of bug it could be. */
void
showLatestBacklog
(
void
)
{
if
(
server
.
repl_backlog
==
NULL
)
return
;
long
long
dumplen
=
256
;
if
(
server
.
repl_backlog_histlen
<
dumplen
)
dumplen
=
server
.
repl_backlog_histlen
;
/* Identify the first byte to dump. */
long
long
idx
=
(
server
.
repl_backlog_idx
+
(
server
.
repl_backlog_size
-
dumplen
))
%
server
.
repl_backlog_size
;
/* Scan the circular buffer to collect 'dumplen' bytes. */
sds
dump
=
sdsempty
();
while
(
dumplen
)
{
long
long
thislen
=
((
server
.
repl_backlog_size
-
idx
)
<
dumplen
)
?
(
server
.
repl_backlog_size
-
idx
)
:
dumplen
;
dump
=
sdscatrepr
(
dump
,
server
.
repl_backlog
+
idx
,
thislen
);
dumplen
-=
thislen
;
idx
=
0
;
}
/* Finally log such bytes: this is vital debugging info to
* understand what happened. */
serverLog
(
LL_WARNING
,
"Latest backlog is: '%s'"
,
dump
);
sdsfree
(
dump
);
}
/* This function is used in order to proxy what we receive from our master
* to our sub-slaves. */
#include <ctype.h>
...
...
src/server.h
浏览文件 @
6a16a636
...
...
@@ -1810,6 +1810,7 @@ void clearReplicationId2(void);
void
chopReplicationBacklog
(
void
);
void
replicationCacheMasterUsingMyself
(
void
);
void
feedReplicationBacklog
(
void
*
ptr
,
size_t
len
);
void
showLatestBacklog
(
void
);
void
rdbPipeReadHandler
(
struct
aeEventLoop
*
eventLoop
,
int
fd
,
void
*
clientData
,
int
mask
);
void
rdbPipeWriteHandlerConnRemoved
(
struct
connection
*
conn
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录