• antirez's avatar
    Cluster: better handling of stolen slots. · 6baac558
    antirez authored
    The previous code handling a lost slot (by another master with an higher
    configuration for the slot) was defensive, considering it an error and
    putting the cluster in an odd state requiring redis-cli fix.
    
    This was changed, because actually this only happens either in a
    legitimate way, with failovers, or when the admin messed with the config
    in order to reconfigure the cluster. So the new code instead will try to
    make sure that the keys stored match the new slots map, by removing all
    the keys in the slots we lost ownership from.
    
    The function that deletes the keys from the lost slots is called only
    if the node does not lose all its slots (resulting in a reconfiguration
    as a slave of the node that got ownership). This is an optimization
    since the replication code will anyway flush all the instance data in
    a faster way.
    6baac558
redis.h 64.8 KB