Sentinel: safer slave reconfig, master reported role should match.

This commit is contained in:
antirez 2013-11-13 17:02:09 +01:00
parent ddaad9fe2d
commit 76a88f56e5

View File

@ -1605,6 +1605,7 @@ void sentinelRefreshInstanceInfo(sentinelRedisInstance *ri, const char *info) {
/* Make sure the master is sane before reconfiguring this instance
* into a slave. */
if (ri->master->flags & SRI_MASTER &&
ri->master->role_reported == SRI_MASTER &&
(ri->master->flags & (SRI_S_DOWN|SRI_O_DOWN)) == 0 &&
(mstime() - ri->master->info_refresh) < SENTINEL_INFO_PERIOD*2)
{