Cluster: actually setup replication in CLUSTER REPLICATE.

This commit is contained in:
antirez 2013-03-04 15:27:58 +01:00
parent 7bead003e2
commit b8a28bf442

View File

@ -1513,7 +1513,7 @@ void clusterSetMaster(clusterNode *n) {
myself->flags |= REDIS_NODE_SLAVE; myself->flags |= REDIS_NODE_SLAVE;
} }
myself->slaveof = n; myself->slaveof = n;
/* TODO: actually handle replication to point to the new slave. */ replicationSetMaster(n->ip, n->port);
} }
/* ----------------------------------------------------------------------------- /* -----------------------------------------------------------------------------
@ -1900,6 +1900,8 @@ void clusterCommand(redisClient *c) {
/* Set the master. */ /* Set the master. */
clusterSetMaster(n); clusterSetMaster(n);
clusterUpdateState();
clusterSaveConfigOrDie();
addReply(c,shared.ok); addReply(c,shared.ok);
} else { } else {
addReplyError(c,"Wrong CLUSTER subcommand or number of arguments"); addReplyError(c,"Wrong CLUSTER subcommand or number of arguments");