Merge commit '9eea57cc311e62a49358e09af7baebce9da9053f' into unstable

Former-commit-id: ee460301fd160cf3fc82e52cf47d4a5f7503d781
This commit is contained in:
John Sully 2019-07-18 23:20:46 -04:00
commit 6f3eda55d9

View File

@ -31,6 +31,7 @@
#include "server.h" #include "server.h"
#include "cluster.h"
#include <sys/time.h> #include <sys/time.h>
#include <unistd.h> #include <unistd.h>
@ -2971,13 +2972,24 @@ void replicationCron(void) {
/* First, send PING according to ping_slave_period. */ /* First, send PING according to ping_slave_period. */
if ((replication_cron_loops % g_pserver->repl_ping_slave_period) == 0 && if ((replication_cron_loops % g_pserver->repl_ping_slave_period) == 0 &&
listLength(g_pserver->slaves) && !clientsArePaused()) listLength(g_pserver->slaves))
{ {
/* Note that we don't send the PING if the clients are paused during
* a Redis Cluster manual failover: the PING we send will otherwise
* alter the replication offsets of master and slave, and will no longer
* match the one stored into 'mf_master_offset' state. */
int manual_failover_in_progress =
g_pserver->cluster_enabled &&
g_pserver->cluster->mf_end &&
clientsArePaused();
if (!manual_failover_in_progress) {
ping_argv[0] = createStringObject("PING",4); ping_argv[0] = createStringObject("PING",4);
replicationFeedSlaves(g_pserver->slaves, g_pserver->slaveseldb, replicationFeedSlaves(g_pserver->slaves, g_pserver->slaveseldb,
ping_argv, 1); ping_argv, 1);
decrRefCount(ping_argv[0]); decrRefCount(ping_argv[0]);
} }
}
/* Second, send a newline to all the slaves in pre-synchronization /* Second, send a newline to all the slaves in pre-synchronization
* stage, that is, slaves waiting for the master to create the RDB file. * stage, that is, slaves waiting for the master to create the RDB file.