From 2b414a4b5f280216c5d97564506ae3ee742ef673 Mon Sep 17 00:00:00 2001 From: antirez Date: Fri, 6 Dec 2013 11:37:46 +0100 Subject: [PATCH] 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. --- src/sentinel.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/sentinel.c b/src/sentinel.c index 1d61ac32..05649b24 100644 --- a/src/sentinel.c +++ b/src/sentinel.c @@ -1131,6 +1131,8 @@ void sentinelResetMaster(sentinelRedisInstance *ri, int flags) { ri->slave_master_host = NULL; ri->last_avail_time = mstime(); ri->last_pong_time = mstime(); + ri->role_reported_time = mstime(); + ri->role_reported = SRI_MASTER; if (flags & SENTINEL_GENERATE_EVENT) sentinelEvent(REDIS_WARNING,"+reset-master",ri,"%@"); }