diff options
author | Oran Agra <oran@redislabs.com> | 2020-07-14 20:21:59 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-07-14 20:21:59 +0300 |
commit | a176cb56a3c0235adddde33fcbaee2369a5af73e (patch) | |
tree | 90262dabe4223f8b3afa9651af8e704514ed88e6 | |
parent | 254c96255420e950bcad1a46bc4f8617b4373797 (diff) | |
download | redis-a176cb56a3c0235adddde33fcbaee2369a5af73e.tar.gz |
diskless master disconnect replicas when rdb child failed (#7518)
in case the rdb child failed, crashed or terminated unexpectedly redis
would have marked the replica clients with repl_put_online_on_ack and
then kill them only after a minute when no ack was received.
it would not stream anything to these connections, so the only effect of
this bug is a delay of 1 minute in the replicas attempt to re-connect.
-rw-r--r-- | src/replication.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/src/replication.c b/src/replication.c index d9bff79ad..8457150a0 100644 --- a/src/replication.c +++ b/src/replication.c @@ -1240,6 +1240,12 @@ void updateSlavesWaitingBgsave(int bgsaveerr, int type) { } else if (slave->replstate == SLAVE_STATE_WAIT_BGSAVE_END) { struct redis_stat buf; + if (bgsaveerr != C_OK) { + freeClient(slave); + serverLog(LL_WARNING,"SYNC failed. BGSAVE child returned an error"); + continue; + } + /* If this was an RDB on disk save, we have to prepare to send * the RDB from disk to the slave socket. Otherwise if this was * already an RDB -> Slaves socket transfer, used in the case of @@ -1278,11 +1284,6 @@ void updateSlavesWaitingBgsave(int bgsaveerr, int type) { slave->repl_put_online_on_ack = 1; slave->repl_ack_time = server.unixtime; /* Timeout otherwise. */ } else { - if (bgsaveerr != C_OK) { - freeClient(slave); - serverLog(LL_WARNING,"SYNC failed. BGSAVE child returned an error"); - continue; - } if ((slave->repldbfd = open(server.rdb_filename,O_RDONLY)) == -1 || redis_fstat(slave->repldbfd,&buf) == -1) { freeClient(slave); |