提交 0caa7507 编写于 作者: A antirez

clear importing/exporing state when appropriate on SETSLOT or ADDSLOTS cluster commands

上级 f9cbdcb1
......@@ -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 {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册