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. (cherry picked from commit a3df70923431bee4aaac0efc46004484a63cb167)
This commit is contained in:
parent
6bdc5a4a08
commit
b0f08a04e0
@ -1240,6 +1240,12 @@ void updateSlavesWaitingBgsave(int bgsaveerr, int type) {
|
|||||||
} else if (slave->replstate == SLAVE_STATE_WAIT_BGSAVE_END) {
|
} else if (slave->replstate == SLAVE_STATE_WAIT_BGSAVE_END) {
|
||||||
struct redis_stat buf;
|
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
|
/* 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
|
* the RDB from disk to the slave socket. Otherwise if this was
|
||||||
* already an RDB -> Slaves socket transfer, used in the case of
|
* 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_put_online_on_ack = 1;
|
||||||
slave->repl_ack_time = server.unixtime; /* Timeout otherwise. */
|
slave->repl_ack_time = server.unixtime; /* Timeout otherwise. */
|
||||||
} else {
|
} 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 ||
|
if ((slave->repldbfd = open(server.rdb_filename,O_RDONLY)) == -1 ||
|
||||||
redis_fstat(slave->repldbfd,&buf) == -1) {
|
redis_fstat(slave->repldbfd,&buf) == -1) {
|
||||||
freeClient(slave);
|
freeClient(slave);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user