diff options
-rw-r--r-- | src/sentinel.c | 10 | ||||
-rw-r--r-- | tests/sentinel/tests/05-manual.tcl | 3 |
2 files changed, 10 insertions, 3 deletions
diff --git a/src/sentinel.c b/src/sentinel.c index baf6f9cbd..0168aa637 100644 --- a/src/sentinel.c +++ b/src/sentinel.c @@ -2579,9 +2579,15 @@ void sentinelSendPeriodicCommands(sentinelRedisInstance *ri) { /* If this is a slave of a master in O_DOWN condition we start sending * it INFO every second, instead of the usual SENTINEL_INFO_PERIOD * period. In this state we want to closely monitor slaves in case they - * are turned into masters by another Sentinel, or by the sysadmin. */ + * are turned into masters by another Sentinel, or by the sysadmin. + * + * Similarly we monitor the INFO output more often if the slave reports + * to be disconnected from the master, so that we can have a fresh + * disconnection time figure. */ if ((ri->flags & SRI_SLAVE) && - (ri->master->flags & (SRI_O_DOWN|SRI_FAILOVER_IN_PROGRESS))) { + ((ri->master->flags & (SRI_O_DOWN|SRI_FAILOVER_IN_PROGRESS)) || + (ri->master_link_down_time != 0))) + { info_period = 1000; } else { info_period = SENTINEL_INFO_PERIOD; diff --git a/tests/sentinel/tests/05-manual.tcl b/tests/sentinel/tests/05-manual.tcl index 1a60d814b..5214fdce1 100644 --- a/tests/sentinel/tests/05-manual.tcl +++ b/tests/sentinel/tests/05-manual.tcl @@ -6,7 +6,8 @@ test "Manual failover works" { set old_port [RI $master_id tcp_port] set addr [S 0 SENTINEL GET-MASTER-ADDR-BY-NAME mymaster] assert {[lindex $addr 1] == $old_port} - S 0 SENTINEL FAILOVER mymaster + catch {S 0 SENTINEL FAILOVER mymaster} reply + assert {$reply eq "OK"} foreach_sentinel_id id { wait_for_condition 1000 50 { [lindex [S $id SENTINEL GET-MASTER-ADDR-BY-NAME mymaster] 1] != $old_port |