Fix for slaves chains. Force resync of slaves (simply disconnecting them) when SLAVEOF turns a master into a slave.

This commit is contained in:
antirez
2012-03-29 09:24:02 +02:00
parent ee704a0ff1
commit ed4d4f1145
3 changed files with 17 additions and 14 deletions

View File

@ -541,6 +541,7 @@ void slaveofCommand(redisClient *c) {
server.masterhost = sdsdup(c->argv[1]->ptr);
server.masterport = port;
if (server.master) freeClient(server.master);
disconnectSlaves(); /* Force our slaves to resync with us as well. */
if (server.repl_state == REDIS_REPL_TRANSFER)
replicationAbortSyncTransfer();
server.repl_state = REDIS_REPL_CONNECT;