summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorantirez <antirez@gmail.com>2014-10-29 12:48:22 +0100
committerantirez <antirez@gmail.com>2014-10-29 14:34:58 +0100
commit9b7a190c82cba04c70db9de7a7d487da4bfad470 (patch)
tree2ef63039df1405c5c8333d9603c3a8d16f91beec
parent49629a2e34a973d5d66d280a9d2ddbd2c37db1cb (diff)
downloadredis-9b7a190c82cba04c70db9de7a7d487da4bfad470.tar.gz
Diskless replication: missing listRewind() added.
This caused BGSAVE to be triggered a second time without any need when we switch from socket to disk target via the command CONFIG SET repl-diskless-sync no and there is already a slave waiting for the BGSAVE to start. Also comments clarified about what is happening.
-rw-r--r--src/replication.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/replication.c b/src/replication.c
index 6ed8cebfa..d14f581a5 100644
--- a/src/replication.c
+++ b/src/replication.c
@@ -1897,7 +1897,11 @@ void replicationCron(void) {
* if there was a recent socket -> disk config change. */
if (startBgsaveForReplication() == REDIS_OK) {
/* It started! We need to change the state of slaves
- * from WAIT_BGSAVE_START to WAIT_BGSAVE_END. */
+ * from WAIT_BGSAVE_START to WAIT_BGSAVE_END in case
+ * the current target is disk. Otherwise it was already done
+ * by rdbSaveToSlavesSockets() which is called by
+ * startBgsaveForReplication(). */
+ listRewind(server.slaves,&li);
while((ln = listNext(&li))) {
redisClient *slave = ln->value;
if (slave->replstate == REDIS_REPL_WAIT_BGSAVE_START)