提交 0b50d1ce 编写于 作者: A antirez

Sentinel: advertise the promoted slave address only after successful setup.

上级 c7b9a57f
......@@ -2035,8 +2035,16 @@ void sentinelCommand(redisClient *c) {
} else {
sentinelAddr *addr = ri->addr;
if ((ri->flags & SRI_FAILOVER_IN_PROGRESS) && ri->promoted_slave)
/* If we are in the middle of a failover, and the slave was
* already successfully switched to master role, we can advertise
* the new address as slave in order to allow clients to talk
* with the new master ASAP. */
if ((ri->flags & SRI_FAILOVER_IN_PROGRESS) &&
ri->promoted_slave &&
ri->failover_state >= SENTINEL_FAILOVER_STATE_RECONF_SLAVES)
{
addr = ri->promoted_slave->addr;
}
addReplyMultiBulkLen(c,2);
addReplyBulkCString(c,addr->ip);
addReplyBulkLongLong(c,addr->port);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册