From c72253ec54d36c6172f8d2ebb6e0eba8d3f5e7cb Mon Sep 17 00:00:00 2001 From: Oran Agra Date: Tue, 31 Mar 2015 23:42:08 +0300 Subject: [PATCH] fixes to diskless replication. master was closing the connection if the RDB transfer took long time. and also sent PINGs to the slave before it got the initial ACK, in which case the slave wouldn't be able to find the EOF marker. --- src/networking.c | 2 +- src/replication.c | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/networking.c b/src/networking.c index 0dfd880a..fbee7212 100644 --- a/src/networking.c +++ b/src/networking.c @@ -134,7 +134,7 @@ int prepareClientToWrite(redisClient *c) { if (c->fd <= 0) return REDIS_ERR; /* Fake client */ if (c->bufpos == 0 && listLength(c->reply) == 0 && (c->replstate == REDIS_REPL_NONE || - c->replstate == REDIS_REPL_ONLINE) && + c->replstate == REDIS_REPL_ONLINE) && !c->repl_put_online_on_ack && aeCreateFileEvent(server.el, c->fd, AE_WRITABLE, sendReplyToClient, c) == AE_ERR) return REDIS_ERR; return REDIS_OK; diff --git a/src/replication.c b/src/replication.c index 13938a1f..cd873159 100644 --- a/src/replication.c +++ b/src/replication.c @@ -768,6 +768,7 @@ void updateSlavesWaitingBgsave(int bgsaveerr, int type) { * is technically online now. */ slave->replstate = REDIS_REPL_ONLINE; slave->repl_put_online_on_ack = 1; + slave->repl_ack_time = server.unixtime; } else { if (bgsaveerr != REDIS_OK) { freeClient(slave);