This function is called when the slave is in * SENTINEL_FAILOVER_STATE_UPDATE_CONFIG state. In this state we need * to remove it from the master table and add the promoted slave instead. */
| 4961 | * SENTINEL_FAILOVER_STATE_UPDATE_CONFIG state. In this state we need |
| 4962 | * to remove it from the master table and add the promoted slave instead. */ |
| 4963 | void sentinelFailoverSwitchToPromotedSlave(sentinelRedisInstance *master) { |
| 4964 | sentinelRedisInstance *ref = master->promoted_slave ? |
| 4965 | master->promoted_slave : master; |
| 4966 | |
| 4967 | sentinelEvent(LL_WARNING,"+switch-master",master,"%s %s %d %s %d", |
| 4968 | master->name, announceSentinelAddr(master->addr), master->addr->port, |
| 4969 | announceSentinelAddr(ref->addr), ref->addr->port); |
| 4970 | |
| 4971 | sentinelResetMasterAndChangeAddress(master,ref->addr->hostname,ref->addr->port); |
| 4972 | } |
| 4973 | |
| 4974 | void sentinelFailoverStateMachine(sentinelRedisInstance *ri) { |
| 4975 | serverAssert(ri->flags & SRI_MASTER); |
no test coverage detected