Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
别团等shy哥发育
redis
提交
3af478e9
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,发现更多精彩内容 >>
提交
3af478e9
编写于
2月 09, 2013
作者:
A
antirez
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
PSYNC: debugging printf() calls are now logs at DEBUG level.
上级
89b48f08
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
14 addition
and
9 deletion
+14
-9
src/replication.c
src/replication.c
+14
-9
未找到文件。
src/replication.c
浏览文件 @
3af478e9
...
...
@@ -333,27 +333,32 @@ void replicationFeedMonitors(redisClient *c, list *monitors, int dictid, robj **
long
long
addReplyReplicationBacklog
(
redisClient
*
c
,
long
long
offset
)
{
long
long
j
,
skip
,
len
;
// printf("SLAVE REQUEST %lld\n
", offset);
redisLog
(
REDIS_DEBUG
,
"[PSYNC] Slave request offset: %lld
"
,
offset
);
if
(
server
.
repl_backlog_histlen
==
0
)
{
// printf("NO HISTORY\n
");
redisLog
(
REDIS_DEBUG
,
"[PSYNC] Backlog history len is zero
"
);
return
0
;
}
// printf("FIRST BYTE WE HAVE %lld\n", server.repl_backlog_off);
// printf("HISTLEN %lld\n", server.repl_backlog_histlen);
// printf("IDX %lld\n", server.repl_backlog_idx);
redisLog
(
REDIS_DEBUG
,
"[PSYNC] Backlog size: %lld"
,
server
.
repl_backlog_size
);
redisLog
(
REDIS_DEBUG
,
"[PSYNC] First byte: %lld"
,
server
.
repl_backlog_off
);
redisLog
(
REDIS_DEBUG
,
"[PSYNC] History len: %lld"
,
server
.
repl_backlog_histlen
);
redisLog
(
REDIS_DEBUG
,
"[PSYNC] Current index: %lld"
,
server
.
repl_backlog_idx
);
/* Compute the amount of bytes we need to discard. */
skip
=
offset
-
server
.
repl_backlog_off
;
// printf("SKIP %lld\n
", skip);
redisLog
(
REDIS_DEBUG
,
"[PSYNC] Skipping: %lld
"
,
skip
);
/* Point j to the oldest byte, that is actaully our
* server.repl_backlog_off byte. */
j
=
(
server
.
repl_backlog_idx
+
(
server
.
repl_backlog_size
-
server
.
repl_backlog_histlen
))
%
server
.
repl_backlog_size
;
// printf("J %lld\n
", j);
redisLog
(
REDIS_DEBUG
,
"[PSYNC] Index of first byte: %lld
"
,
j
);
/* Discard the amount of data to seek to the specified 'offset'. */
j
=
(
j
+
skip
)
%
server
.
repl_backlog_size
;
...
...
@@ -361,13 +366,13 @@ long long addReplyReplicationBacklog(redisClient *c, long long offset) {
/* Feed slave with data. Since it is a circular buffer we have to
* split the reply in two parts if we are cross-boundary. */
len
=
server
.
repl_backlog_histlen
-
skip
;
// printf("LEN %lld\n
", len);
redisLog
(
REDIS_DEBUG
,
"[PSYNC] Reply total length: %lld
"
,
len
);
while
(
len
)
{
long
long
thislen
=
((
server
.
repl_backlog_size
-
j
)
<
len
)
?
(
server
.
repl_backlog_size
-
j
)
:
len
;
// printf("WRITE %lld\n
", thislen);
redisLog
(
REDIS_DEBUG
,
"[PSYNC] addReply() length: %lld
"
,
thislen
);
addReplySds
(
c
,
sdsnewlen
(
server
.
repl_backlog
+
j
,
thislen
));
len
-=
thislen
;
j
=
0
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录