From 47bbaa17b00e4d4f1128d9249cbbe7be8cc702e5 Mon Sep 17 00:00:00 2001 From: antirez Date: Fri, 20 Mar 2015 16:56:44 +0100 Subject: [PATCH] Cluster: separate unknown master check from the rest. In no case we should try to attempt to failover if myself->slaveof is NULL. --- src/cluster.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/cluster.c b/src/cluster.c index 4ff8fb4d..74468cfa 100644 --- a/src/cluster.c +++ b/src/cluster.c @@ -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"); -- GitLab