mirror of
https://github.com/fluencelabs/redis
synced 2025-03-30 22:31:03 +00:00
Sentinel: make sure role_reported is always updated.
This commit is contained in:
parent
46a053d34b
commit
17718fdcba
@ -1546,13 +1546,13 @@ void sentinelRefreshInstanceInfo(sentinelRedisInstance *ri, const char *info) {
|
|||||||
/* When what we believe is our master, turned into a slave, the wiser
|
/* 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
|
* thing we can do is to follow the events and redirect to the new
|
||||||
* master, always. */
|
* master, always. */
|
||||||
if ((ri->flags & SRI_MASTER) && role == SRI_SLAVE && ri->slave_master_host)
|
if ((ri->flags & SRI_MASTER) && role == SRI_SLAVE) {
|
||||||
{
|
|
||||||
if (ri->role_reported != SRI_MASTER) {
|
if (ri->role_reported != SRI_MASTER) {
|
||||||
ri->role_reported_time = mstime();
|
ri->role_reported_time = mstime();
|
||||||
ri->role_reported = SRI_MASTER;
|
ri->role_reported = SRI_MASTER;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (ri->slave_master_host) {
|
||||||
sentinelEvent(REDIS_WARNING,"+redirect-to-master",ri,
|
sentinelEvent(REDIS_WARNING,"+redirect-to-master",ri,
|
||||||
"%s %s %d %s %d",
|
"%s %s %d %s %d",
|
||||||
ri->name, ri->addr->ip, ri->addr->port,
|
ri->name, ri->addr->ip, ri->addr->port,
|
||||||
@ -1561,6 +1561,7 @@ void sentinelRefreshInstanceInfo(sentinelRedisInstance *ri, const char *info) {
|
|||||||
ri->slave_master_port);
|
ri->slave_master_port);
|
||||||
return; /* Don't process anything after this event. */
|
return; /* Don't process anything after this event. */
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* Handle slave -> master role switch. */
|
/* Handle slave -> master role switch. */
|
||||||
if ((ri->flags & SRI_SLAVE) && role == SRI_MASTER) {
|
if ((ri->flags & SRI_SLAVE) && role == SRI_MASTER) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user