Commit f472bb10 authored by Oran Agra's avatar Oran Agra
Browse files

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.
parent fe63046e
...@@ -149,7 +149,7 @@ int prepareClientToWrite(redisClient *c) { ...@@ -149,7 +149,7 @@ int prepareClientToWrite(redisClient *c) {
if (c->fd <= 0) return REDIS_ERR; /* Fake client */ if (c->fd <= 0) return REDIS_ERR; /* Fake client */
if (c->bufpos == 0 && listLength(c->reply) == 0 && if (c->bufpos == 0 && listLength(c->reply) == 0 &&
(c->replstate == REDIS_REPL_NONE || (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, aeCreateFileEvent(server.el, c->fd, AE_WRITABLE,
sendReplyToClient, c) == AE_ERR) return REDIS_ERR; sendReplyToClient, c) == AE_ERR) return REDIS_ERR;
return REDIS_OK; return REDIS_OK;
......
...@@ -773,6 +773,7 @@ void updateSlavesWaitingBgsave(int bgsaveerr, int type) { ...@@ -773,6 +773,7 @@ void updateSlavesWaitingBgsave(int bgsaveerr, int type) {
* is technically online now. */ * is technically online now. */
slave->replstate = REDIS_REPL_ONLINE; slave->replstate = REDIS_REPL_ONLINE;
slave->repl_put_online_on_ack = 1; slave->repl_put_online_on_ack = 1;
slave->repl_ack_time = server.unixtime;
} else { } else {
if (bgsaveerr != REDIS_OK) { if (bgsaveerr != REDIS_OK) {
freeClient(slave); freeClient(slave);
......
...@@ -189,7 +189,7 @@ static size_t rioFdRead(rio *r, void *buf, size_t len) { ...@@ -189,7 +189,7 @@ static size_t rioFdRead(rio *r, void *buf, size_t len) {
if (toread > sdsavail(r->io.fd.buf)) if (toread > sdsavail(r->io.fd.buf))
toread = sdsavail(r->io.fd.buf); toread = sdsavail(r->io.fd.buf);
int retval = read(r->io.fd.fd, (char*)r->io.fd.buf + sdslen(r->io.fd.buf), toread); int retval = read(r->io.fd.fd, (char*)r->io.fd.buf + sdslen(r->io.fd.buf), toread);
if (retval == -1) { if (retval <= 0) {
if (errno == EWOULDBLOCK) errno = ETIMEDOUT; if (errno == EWOULDBLOCK) errno = ETIMEDOUT;
return 0; return 0;
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment