提交 8297745f 编写于 作者: A antirez

Sentinel: redirect-to-master is not ok with new algorithm.

Now Sentinel believe the current configuration is always the winner and
should be applied by Sentinels instead of trying to adapt our view of
the cluster based on what we observe.

So the only way to modify what a Sentinel believe to be the truth is to
win an election and advertise the new configuration via Pub / Sub with a
greater configuration epoch.
上级 76a88f56
......@@ -1543,24 +1543,12 @@ void sentinelRefreshInstanceInfo(sentinelRedisInstance *ri, const char *info) {
* Some things will not happen if sentinel.tilt is true, but some will
* still be processed. */
/* When what we believe is our master, turned into a slave, the wiser
* thing we can do is to follow the events and redirect to the new
* master, always. */
/* Handle master -> slave role switch. */
if ((ri->flags & SRI_MASTER) && role == SRI_SLAVE) {
if (ri->role_reported != SRI_SLAVE) {
ri->role_reported_time = mstime();
ri->role_reported = SRI_SLAVE;
}
if (ri->slave_master_host) {
sentinelEvent(REDIS_WARNING,"+redirect-to-master",ri,
"%s %s %d %s %d",
ri->name, ri->addr->ip, ri->addr->port,
ri->slave_master_host, ri->slave_master_port);
sentinelResetMasterAndChangeAddress(ri,ri->slave_master_host,
ri->slave_master_port);
return; /* Don't process anything after this event. */
}
}
/* Handle slave -> master role switch. */
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册