mirror of
https://github.com/fluencelabs/redis
synced 2025-03-18 16:40:50 +00:00
Cluster: conditions to clear "migrating" on slot for SETSLOT ... NODE changed.
If the slot is manually assigned to another node, clear the migrating status regardless of the fact it was previously assigned to us or not, as long as we no longer have keys for this slot. This avoid a race during slots migration that may leave the slot in migrating status in the source node, since it received an update message from the destination node that is already claiming the slot. This way we are sure that redis-trib at the end of the slot migration is always able to close the slot correctly.
This commit is contained in:
parent
3107e7ca60
commit
218358bbbd
@ -3154,10 +3154,10 @@ 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
|
||||
/* If this slot is in migrating status but we have no keys
|
||||
* for it assigning the slot to another node will clear
|
||||
* the migratig status. */
|
||||
if (server.cluster->slots[slot] == myself &&
|
||||
if (countKeysInSlot(slot) == 0 &&
|
||||
server.cluster->migrating_slots_to[slot])
|
||||
server.cluster->migrating_slots_to[slot] = NULL;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user