X-Git-Url: https://git.saurik.com/redis.git/blobdiff_plain/f9cbdcb1a67e8903c976e588bbf24f0fe6bf2fac..40531be0e338556df5510f49f4472ea50713962f:/src/cluster.c?ds=sidebyside diff --git a/src/cluster.c b/src/cluster.c index 2e9b256c..3e65af78 100644 --- a/src/cluster.c +++ b/src/cluster.c @@ -1222,9 +1222,15 @@ void clusterCommand(redisClient *c) { } for (j = 0; j < REDIS_CLUSTER_SLOTS; j++) { if (slots[j]) { - int retval = del ? clusterDelSlot(j) : - clusterAddSlot(server.cluster.myself,j); - + int retval; + + /* If this slot was set as importing we can clear this + * state as now we are the real owner of the slot. */ + if (server.cluster.importing_slots_from[j]) + server.cluster.importing_slots_from[j] = NULL; + + retval = del ? clusterDelSlot(j) : + clusterAddSlot(server.cluster.myself,j); redisAssert(retval == REDIS_OK); } } @@ -1290,6 +1296,13 @@ void clusterCommand(redisClient *c) { return; } } + /* If this node was the slot owner and the slot was marked as + * migrating, assigning the slot to another node will clear + * the migratig status. */ + if (server.cluster.slots[slot] == server.cluster.myself && + server.cluster.migrating_slots_to[slot]) + server.cluster.migrating_slots_to[slot] = NULL; + clusterDelSlot(slot); clusterAddSlot(n,slot); } else {