mirror of
https://github.com/fluencelabs/redis
synced 2025-03-17 16:10:50 +00:00
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.
This commit is contained in:
parent
76a88f56e5
commit
8297745fa6
@ -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. */
|
||||
|
Loading…
x
Reference in New Issue
Block a user