Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ruanhaishen
redis
Commits
3af478e9
Commit
3af478e9
authored
Feb 09, 2013
by
antirez
Browse files
PSYNC: debugging printf() calls are now logs at DEBUG level.
parent
89b48f08
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/replication.c
View file @
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
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment