提交 e15ba6a6 编写于 作者: A antirez

Sentinel: fix address of master in Hello messages.

Once we switched configuration during a failover, we should advertise
the new address.

This was a serious race condition as the Sentinel performing the
failover for a moment advertised the old address with the new
configuration epoch: once trasmitted to the other Sentinels the broken
configuration would remain there forever, until the next failover
(because a greater configuration epoch is required to overwrite an older
one).
上级 1a6abe7d
......@@ -1938,6 +1938,7 @@ void sentinelPingInstance(sentinelRedisInstance *ri) {
char payload[REDIS_IP_STR_LEN+1024];
sentinelRedisInstance *master = (ri->flags & SRI_MASTER) ?
ri : ri->master;
sentinelAddr *master_addr = sentinelGetCurrentMasterAddress(master);
snprintf(payload,sizeof(payload),
"%s,%d,%s,%d,%llu," /* Info about this sentinel. */
......@@ -1946,7 +1947,7 @@ void sentinelPingInstance(sentinelRedisInstance *ri) {
(master->flags & SRI_CAN_FAILOVER) != 0,
(unsigned long long) sentinel.current_epoch,
/* --- */
master->name,master->addr->ip,master->addr->port,
master->name,master_addr->ip,master_addr->port,
master->config_epoch);
retval = redisAsyncCommand(ri->cc,
sentinelPublishReplyCallback, NULL, "PUBLISH %s %s",
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册