first attempt to non blocking implementation of slave replication and SYNC bulk data download. Never compiled so far...

This commit is contained in:
antirez
2010-11-04 17:29:53 +01:00
parent 4d7e125519
commit f4aa600b99
4 changed files with 117 additions and 44 deletions

View File

@ -633,14 +633,10 @@ int serverCron(struct aeEventLoop *eventLoop, long long id, void *clientData) {
}
}
/* Check if we should connect to a MASTER */
if (server.replstate == REDIS_REPL_CONNECT && !(loops % 10)) {
redisLog(REDIS_NOTICE,"Connecting to MASTER...");
if (syncWithMaster() == REDIS_OK) {
redisLog(REDIS_NOTICE,"MASTER <-> SLAVE sync succeeded");
if (server.appendonly) rewriteAppendOnlyFileBackground();
}
}
/* Replication cron function -- used to reconnect to master and
* to detect transfer failures. */
if (!(loops % 10)) replicationCron(void);
return 100;
}