summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorantirez <antirez@gmail.com>2014-10-10 16:25:58 +0200
committerantirez <antirez@gmail.com>2014-10-10 16:25:58 +0200
commit16546f5aca1236a179bff98af9aaee491cd6fd4d (patch)
tree9dc149659ddd316d42493acdf059ddec877939ca
parent2df8341c75f46cf2d6ec28804cbda6287766262d (diff)
downloadredis-16546f5aca1236a179bff98af9aaee491cd6fd4d.tar.gz
Add some comments in syncCommand() to clarify RDB target.
-rw-r--r--src/replication.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/src/replication.c b/src/replication.c
index 16014c8a9..f4ac58f4d 100644
--- a/src/replication.c
+++ b/src/replication.c
@@ -468,7 +468,7 @@ void syncCommand(redisClient *c) {
if (server.rdb_child_pid != -1) {
/* 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
- * registering differences since the server forked to save */
+ * registering differences since the server forked to save. */
redisClient *slave;
listNode *ln;
listIter li;
@@ -480,18 +480,23 @@ void syncCommand(redisClient *c) {
}
if (ln) {
/* 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);
c->replstate = REDIS_REPL_WAIT_BGSAVE_END;
redisLog(REDIS_NOTICE,"Waiting for end of BGSAVE for SYNC");
} else {
/* No way, we need to wait for the next BGSAVE in order to
- * register differences */
+ * register differences. */
c->replstate = REDIS_REPL_WAIT_BGSAVE_START;
redisLog(REDIS_NOTICE,"Waiting for next BGSAVE for SYNC");
}
} 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");
if (rdbSaveBackground(server.rdb_filename) != REDIS_OK) {
redisLog(REDIS_NOTICE,"Replication failed, can't BGSAVE");