• antirez's avatar
    Sentinel: more robust failover detection as observer. · e01a415d
    antirez authored
    Sentinel observers detect failover checking if a slave attached to the
    monitored master turns into its replication state from slave to master.
    However while this change may in theory only happen after a SLAVEOF NO
    ONE command, in practie it is very easy to reboot a slave instance with
    a wrong configuration that turns it into a master, especially if it was
    a past master before a successfull failover.
    
    This commit changes the detection policy so that if an instance goes
    from slave to master, but at the same time the runid has changed, we
    sense a reboot, and in that case we don't detect a failover at all.
    
    This commit also introduces the "reboot" sentinel event, that is logged
    at "warning" level (so this will trigger an admin notification).
    
    The commit also fixes a problem in the disconnect handler that assumed
    that the instance object always existed, that is not the case. Now we
    no longer assume that redisAsyncFree() will call the disconnection
    handler before returning.
    e01a415d
sentinel.c 92.1 KB