Describe the bug

When I try to move all slots on two or more nodes to other nodes using redis-cli --cluster rebalance, rebalancing can be stopped along the way.

To reproduce

When I have a Redis cluster of 12 master nodes, and want to scale it down to 6 masters, I would be able to use rebalance command like this.

redis-cli --cluster rebalance \
  --cluster-weight {node07_id}=0 \
  --cluster-weight {node08_id}=0 \
  --cluster-weight {node09_id}=0
  --cluster-weight {node10_id}=0 \
  --cluster-weight {node11_id}=0 \
  --cluster-weight {node12_id}=0
  __worker_node_addr__

And it can stop with the following errors: - ERR Please use SETSLOT only with masters. - LOADING Redis is loading the dataset in memory

Expected behavior

Loading errors can also be ignored.

Additional information

This problem occurs because nodes that were recognized as masters at the beginning of redis-cli execution are converted to replicas as their slots become 0.

When the node that used to be the master changes to a replica, and executes the CLUSTER SETSLOT command on that node, the following error occurs.

  • ERR Please use SETSLOT only with masters.

However, during the process of becoming a replica and synchronizing with the new master, a LOADING error will occur for the CLUSTER SETSLOT command.

  • LOADING Redis is loading the dataset in memory

Of course, there were patches related to this in the past. - issue: https://github.com/redis/redis/issues/9223 - fixed by: https://github.com/redis/redis/pull/10381

But what was previously patched was only for source, and the problem I ran into was that of notifications to others. https://github.com/redis/redis/blob/44859a41ee63b52632f0726d7bf1e6ca1ce47f83/src/redis-cli.c#L4479

I think the error can be ignored for the following reasons. - This error will occur only when changing from master to replica. - Nodes that were replicas from the beginning were not targets to notify.

Another solution is to omit the notification to nodes that do not have any slots. However, I am not sure that there is no side effect.