• Binbin's avatar
    Fix CLUSTER SHARDS crash in 7.0/7.2 mixed clusters where shard ids are not sync (#12832) · 85408b73
    Binbin authored
    Crash reported in #12695. In the process of upgrading the cluster from
    7.0 to 7.2, because the 7.0 nodes will not gossip shard id, in 7.2 we
    will rely on shard id to build the server.cluster->shards dict.
    
    In some cases, for example, the 7.0 master node and the 7.2 replica node.
    From the view of 7.2 replica node, the cluster->shards dictionary does not
    have its master node. In this case calling CLUSTER SHARDS on the 7.2 replica
    node may crash.
    
    We should fix the underlying assumption of updateShardId, which is that the
    shard dict should be always in sync with the node's shard_id. The fix was
    suggested by PingXie, see more details in #12695.
    
    (cherry picked from commit 5b0c6a82)
    85408b73
cluster.c 303 KB