summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorantirez <antirez@gmail.com>2019-05-15 12:16:43 +0200
committerantirez <antirez@gmail.com>2019-05-15 12:16:43 +0200
commit074d24df1e82b5c794a5da9fb6cda5b77b60b27b (patch)
treec15db2bd00b38bda40b4703de7fc2bf1604a7e7b
parentcaf74e507e6535dab58ce6f3db19f8b594b5f7ca (diff)
downloadredis-074d24df1e82b5c794a5da9fb6cda5b77b60b27b.tar.gz
Narrow the effects of PR #6029 to the exact state.
CLIENT PAUSE may be used, in other contexts, for a long time making all the slaves time out. Better for now to be more specific about what should disable senidng PINGs. An alternative to that would be to virtually refresh the slave interactions when clients are paused, however for now I went for this more conservative solution.
-rw-r--r--src/replication.c22
1 files changed, 17 insertions, 5 deletions
diff --git a/src/replication.c b/src/replication.c
index bfe50c929..63a67a06a 100644
--- a/src/replication.c
+++ b/src/replication.c
@@ -30,6 +30,7 @@
#include "server.h"
+#include "cluster.h"
#include <sys/time.h>
#include <unistd.h>
@@ -2601,12 +2602,23 @@ void replicationCron(void) {
/* First, send PING according to ping_slave_period. */
if ((replication_cron_loops % server.repl_ping_slave_period) == 0 &&
- listLength(server.slaves) && !clientsArePaused())
+ listLength(server.slaves))
{
- ping_argv[0] = createStringObject("PING",4);
- replicationFeedSlaves(server.slaves, server.slaveseldb,
- ping_argv, 1);
- decrRefCount(ping_argv[0]);
+ /* 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 =
+ server.cluster_enabled &&
+ server.cluster->mf_end &&
+ clientsArePaused();
+
+ if (!manual_failover_in_progress) {
+ ping_argv[0] = createStringObject("PING",4);
+ replicationFeedSlaves(server.slaves, server.slaveseldb,
+ ping_argv, 1);
+ decrRefCount(ping_argv[0]);
+ }
}
/* Second, send a newline to all the slaves in pre-synchronization