mirror of
https://github.com/fluencelabs/redis
synced 2025-06-12 16:51:22 +00:00
Don't disconnect pre PSYNC replication clients for timeout.
Clients using SYNC to replicate are older implementations, such as redis-cli --slave, and are not designed to acknowledge the master with REPLCONF ACK commands, so we don't have any feedback and should not disconnect them on timeout.
This commit is contained in:
@ -505,6 +505,11 @@ void syncCommand(redisClient *c) {
|
||||
* resync. */
|
||||
if (master_runid[0] != '?') server.stat_sync_partial_err++;
|
||||
}
|
||||
} else {
|
||||
/* If a slave uses SYNC, we are dealing with an old implementation
|
||||
* of the replication protocol (like redis-cli --slave). Flag the client
|
||||
* so that we don't expect to receive REPLCONF ACK feedbacks. */
|
||||
c->flags |= REDIS_PRE_PSYNC_SLAVE;
|
||||
}
|
||||
|
||||
/* Full resynchronization. */
|
||||
@ -1586,6 +1591,7 @@ void replicationCron(void) {
|
||||
redisClient *slave = ln->value;
|
||||
|
||||
if (slave->replstate != REDIS_REPL_ONLINE) continue;
|
||||
if (slave->flags & REDIS_PRE_PSYNC_SLAVE) continue;
|
||||
if ((server.unixtime - slave->repl_ack_time) > server.repl_timeout)
|
||||
{
|
||||
char ip[32];
|
||||
|
Reference in New Issue
Block a user