• Binbin's avatar
    Changed activeExpireCycle server.masterhost check to iAmMaster in beforeSleep (#11997) · aee8d1ff
    Binbin authored
    In cluster mode, when a node restart as a replica, it doesn't immediately
    sync with the master, replication is enabled in clusterCron. It means that
    sometime server.masterhost is NULL and we wrongly judge it in beforeSleep.
    
    In this case, we may trigger a fast activeExpireCycle in beforeSleep, but the
    node's flag is actually a replica, that can lead to data inconsistency.  In this
    PR, we use iAmMaster to replace the `server.masterhost == NULL`
    
    This is an overlook in #7001, and more discussion in #11783.
    aee8d1ff
server.c 283 KB