From c5954c196679cbc830fd835d6b72bbd94422fe5a Mon Sep 17 00:00:00 2001
From: antirez <antirez@gmail.com>
Date: Fri, 30 Sep 2011 19:20:56 +0200
Subject: [PATCH] Clear the importing status from the slot if a CLUSTER SETSLOT
 command permanently assigns the slot to the importing node.

---
 src/cluster.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/src/cluster.c b/src/cluster.c
index ed07a84f..e876baeb 100644
--- a/src/cluster.c
+++ b/src/cluster.c
@@ -1305,6 +1305,11 @@ void clusterCommand(redisClient *c) {
                 server.cluster.migrating_slots_to[slot])
                 server.cluster.migrating_slots_to[slot] = NULL;
 
+            /* If this node was importing this slot, assigning the slot to
+             * itself also clears the importing status. */
+            if (n == server.cluster.myself && server.cluster.importing_slots_from[slot])
+                server.cluster.importing_slots_from[slot] = NULL;
+
             clusterDelSlot(slot);
             clusterAddSlot(n,slot);
         } else {