Unverified Commit e5ef1613 authored by Binbin's avatar Binbin Committed by GitHub
Browse files

Fix crash when running rebalance command in a mixed cluster of 7.0 and 7.2 (#12604)

In #10536, we introduced the assert, some older versions of servers
(like 7.0) doesn't gossip shard_id, so we will not add the node to
cluster->shards, and node->shard_id is filled in randomly and may not
be found here.

It causes that if we add a 7.2 node to a 7.0 cluster and allocate slots
to the 7.2 node, the 7.2 node will crash when it hits this assert. Somehow
like #12538.

In this PR, we remove the assert and replace it with an unconditional removal.
parent 4de4fcf2
...@@ -4935,12 +4935,8 @@ int clusterDelSlot(int slot) { ...@@ -4935,12 +4935,8 @@ int clusterDelSlot(int slot) {
if (!n) return C_ERR; if (!n) return C_ERR;
/* Cleanup the channels in master/replica as part of slot deletion. */ /* Cleanup the channels in master/replica as part of slot deletion. */
list *nodes_for_slot = clusterGetNodesInMyShard(n); removeChannelsInSlot(slot);
serverAssert(nodes_for_slot != NULL); /* Clear the slot bit. */
listNode *ln = listSearchKey(nodes_for_slot, myself);
if (ln != NULL) {
removeChannelsInSlot(slot);
}
serverAssert(clusterNodeClearSlotBit(n,slot) == 1); serverAssert(clusterNodeClearSlotBit(n,slot) == 1);
server.cluster->slots[slot] = NULL; server.cluster->slots[slot] = NULL;
/* Make owner_not_claiming_slot flag consistent with slot ownership information. */ /* Make owner_not_claiming_slot flag consistent with slot ownership information. */
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment