Commit 47bbaa17 authored by antirez's avatar antirez
Browse files

Cluster: separate unknown master check from the rest.

In no case we should try to attempt to failover if myself->slaveof is
NULL.
parent 0595420b
...@@ -4176,9 +4176,12 @@ void clusterCommand(redisClient *c) { ...@@ -4176,9 +4176,12 @@ void clusterCommand(redisClient *c) {
if (nodeIsMaster(myself)) { if (nodeIsMaster(myself)) {
addReplyError(c,"You should send CLUSTER FAILOVER to a slave"); addReplyError(c,"You should send CLUSTER FAILOVER to a slave");
return; return;
} else if (myself->slaveof == NULL) {
addReplyError(c,"I'm a slave but my master is unknown to me");
return;
} else if (!force && } else if (!force &&
(myself->slaveof == NULL || nodeFailed(myself->slaveof) || (nodeFailed(myself->slaveof) ||
myself->slaveof->link == NULL)) myself->slaveof->link == NULL))
{ {
addReplyError(c,"Master is down or failed, " addReplyError(c,"Master is down or failed, "
"please use CLUSTER FAILOVER FORCE"); "please use CLUSTER FAILOVER FORCE");
......
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