Commit dceaca1f authored by antirez's avatar antirez
Browse files

Sentinel: fix reported role fields when master is reset.

When there is a master address switch, the reported role must be set to
master so that we have a chance to re-sample the INFO output to check if
the new address is reporting the right role.

Otherwise if the role was wrong, it will be sensed as wrong even after
the address switch, and for enough time according to the role change
time, for Sentinel consider the master SDOWN.

This fixes isue #1446, that describes the effects of this bug in
practice.
parent bf307cfb
...@@ -1133,6 +1133,8 @@ void sentinelResetMaster(sentinelRedisInstance *ri, int flags) { ...@@ -1133,6 +1133,8 @@ void sentinelResetMaster(sentinelRedisInstance *ri, int flags) {
ri->slave_master_host = NULL; ri->slave_master_host = NULL;
ri->last_avail_time = mstime(); ri->last_avail_time = mstime();
ri->last_pong_time = mstime(); ri->last_pong_time = mstime();
ri->role_reported_time = mstime();
ri->role_reported = SRI_MASTER;
if (flags & SENTINEL_GENERATE_EVENT) if (flags & SENTINEL_GENERATE_EVENT)
sentinelEvent(REDIS_WARNING,"+reset-master",ri,"%@"); sentinelEvent(REDIS_WARNING,"+reset-master",ri,"%@");
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment