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
16546f5a
Commit
16546f5a
authored
Oct 10, 2014
by
antirez
Browse files
Add some comments in syncCommand() to clarify RDB target.
parent
2df8341c
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/replication.c
View file @
16546f5a
...
@@ -468,7 +468,7 @@ void syncCommand(redisClient *c) {
...
@@ -468,7 +468,7 @@ void syncCommand(redisClient *c) {
if
(
server
.
rdb_child_pid
!=
-
1
)
{
if
(
server
.
rdb_child_pid
!=
-
1
)
{
/* Ok a background save is in progress. Let's check if it is a good
/* Ok a background save is in progress. Let's check if it is a good
* one for replication, i.e. if there is another slave that is
* one for replication, i.e. if there is another slave that is
* registering differences since the server forked to save */
* registering differences since the server forked to save
.
*/
redisClient
*
slave
;
redisClient
*
slave
;
listNode
*
ln
;
listNode
*
ln
;
listIter
li
;
listIter
li
;
...
@@ -480,18 +480,23 @@ void syncCommand(redisClient *c) {
...
@@ -480,18 +480,23 @@ void syncCommand(redisClient *c) {
}
}
if
(
ln
)
{
if
(
ln
)
{
/* Perfect, the server is already registering differences for
/* Perfect, the server is already registering differences for
* another slave. Set the right state, and copy the buffer. */
* another slave. Set the right state, and copy the buffer.
*
* Note that if we found a slave in WAIT_BGSAVE_END state, this
* means that the current child is of type
* REDIS_RDB_CHILD_TYPE_DISK, since the first slave in this state
* can only be added when an RDB save with disk target is started. */
copyClientOutputBuffer
(
c
,
slave
);
copyClientOutputBuffer
(
c
,
slave
);
c
->
replstate
=
REDIS_REPL_WAIT_BGSAVE_END
;
c
->
replstate
=
REDIS_REPL_WAIT_BGSAVE_END
;
redisLog
(
REDIS_NOTICE
,
"Waiting for end of BGSAVE for SYNC"
);
redisLog
(
REDIS_NOTICE
,
"Waiting for end of BGSAVE for SYNC"
);
}
else
{
}
else
{
/* No way, we need to wait for the next BGSAVE in order to
/* No way, we need to wait for the next BGSAVE in order to
* register differences */
* register differences
.
*/
c
->
replstate
=
REDIS_REPL_WAIT_BGSAVE_START
;
c
->
replstate
=
REDIS_REPL_WAIT_BGSAVE_START
;
redisLog
(
REDIS_NOTICE
,
"Waiting for next BGSAVE for SYNC"
);
redisLog
(
REDIS_NOTICE
,
"Waiting for next BGSAVE for SYNC"
);
}
}
}
else
{
}
else
{
/* Ok we don't have a BGSAVE in progress, let's start one */
/* Ok we don't have a BGSAVE in progress, let's start one
.
*/
redisLog
(
REDIS_NOTICE
,
"Starting BGSAVE for SYNC"
);
redisLog
(
REDIS_NOTICE
,
"Starting BGSAVE for SYNC"
);
if
(
rdbSaveBackground
(
server
.
rdb_filename
)
!=
REDIS_OK
)
{
if
(
rdbSaveBackground
(
server
.
rdb_filename
)
!=
REDIS_OK
)
{
redisLog
(
REDIS_NOTICE
,
"Replication failed, can't BGSAVE"
);
redisLog
(
REDIS_NOTICE
,
"Replication failed, can't BGSAVE"
);
...
...
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