Skip to content

Commit 074d24d

Browse files
committed
Narrow the effects of PR redis#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.
1 parent caf74e5 commit 074d24d

File tree

1 file changed

+17
-5
lines changed

1 file changed

+17
-5
lines changed

src/replication.c

+17-5
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030

3131

3232
#include "server.h"
33+
#include "cluster.h"
3334

3435
#include <sys/time.h>
3536
#include <unistd.h>
@@ -2601,12 +2602,23 @@ void replicationCron(void) {
26012602

26022603
/* First, send PING according to ping_slave_period. */
26032604
if ((replication_cron_loops % server.repl_ping_slave_period) == 0 &&
2604-
listLength(server.slaves) && !clientsArePaused())
2605+
listLength(server.slaves))
26052606
{
2606-
ping_argv[0] = createStringObject("PING",4);
2607-
replicationFeedSlaves(server.slaves, server.slaveseldb,
2608-
ping_argv, 1);
2609-
decrRefCount(ping_argv[0]);
2607+
/* Note that we don't send the PING if the clients are paused during
2608+
* a Redis Cluster manual failover: the PING we send will otherwise
2609+
* alter the replication offsets of master and slave, and will no longer
2610+
* match the one stored into 'mf_master_offset' state. */
2611+
int manual_failover_in_progress =
2612+
server.cluster_enabled &&
2613+
server.cluster->mf_end &&
2614+
clientsArePaused();
2615+
2616+
if (!manual_failover_in_progress) {
2617+
ping_argv[0] = createStringObject("PING",4);
2618+
replicationFeedSlaves(server.slaves, server.slaveseldb,
2619+
ping_argv, 1);
2620+
decrRefCount(ping_argv[0]);
2621+
}
26102622
}
26112623

26122624
/* Second, send a newline to all the slaves in pre-synchronization

0 commit comments

Comments
 (0)