Skip to content

Commit

Permalink
Cluster: separate unknown master check from the rest.
Browse files Browse the repository at this point in the history
In no case we should try to attempt to failover if myself->slaveof is
NULL.
  • Loading branch information
antirez committed Mar 21, 2015
1 parent 0595420 commit 47bbaa1
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/cluster.c
Original file line number Diff line number Diff line change
Expand Up @@ -4176,9 +4176,12 @@ void clusterCommand(redisClient *c) {
if (nodeIsMaster(myself)) {
addReplyError(c,"You should send CLUSTER FAILOVER to a slave");
return;
} else if (myself->slaveof == NULL) {
addReplyError(c,"I'm a slave but my master is unknown to me");
return;
} else if (!force &&
(myself->slaveof == NULL || nodeFailed(myself->slaveof) ||
myself->slaveof->link == NULL))
(nodeFailed(myself->slaveof) ||
myself->slaveof->link == NULL))
{
addReplyError(c,"Master is down or failed, "
"please use CLUSTER FAILOVER FORCE");
Expand Down

0 comments on commit 47bbaa1

Please sign in to comment.