diff --git a/sentinel.conf b/sentinel.conf index a395ad16c0..f44c116eff 100644 --- a/sentinel.conf +++ b/sentinel.conf @@ -347,12 +347,12 @@ SENTINEL resolve-hostnames no # SENTINEL announce-hostnames no -# When master_reboot_down_after_period is set to 0, Sentinel does not fail over -# when receiving a -LOADING response from a master. This was the only supported -# behavior before version 7.0. +# When primary-reboot-down-after-period is set to 0, Sentinel does not fail over +# when receiving a -LOADING response from a primary. This was the only supported +# behavior before Redis OSS 7.0. # # Otherwise, Sentinel will use this value as the time (in ms) it is willing to -# accept a -LOADING response after a master has been rebooted, before failing +# accept a -LOADING response after a primary has been rebooted, before failing # over. -SENTINEL master-reboot-down-after-period mymaster 0 +SENTINEL primary-reboot-down-after-period myprimary 0 diff --git a/src/sentinel.c b/src/sentinel.c index a095b8f48a..7eee2562cc 100644 --- a/src/sentinel.c +++ b/src/sentinel.c @@ -1946,7 +1946,9 @@ const char *sentinelHandleConfiguration(char **argv, int argc) { if ((sentinel.announce_hostnames = yesnotoi(argv[1])) == -1) { return "Please specify yes or no for the announce-hostnames option."; } - } else if (!strcasecmp(argv[0], "master-reboot-down-after-period") && argc == 3) { + } else if ((!strcasecmp(argv[0], "primary-reboot-down-after-period") || + !strcasecmp(argv[0], "master-reboot-down-after-period")) && + argc == 3) { /* primary-reboot-down-after-period */ ri = sentinelGetPrimaryByName(argv[1]); if (!ri) return "No such master with specified name."; @@ -2058,9 +2060,9 @@ void rewriteConfigSentinelOption(struct rewriteConfigState *state) { /* sentinel primary-reboot-down-after-period */ if (primary->primary_reboot_down_after_period != 0) { - line = sdscatprintf(sdsempty(), "sentinel master-reboot-down-after-period %s %ld", primary->name, + line = sdscatprintf(sdsempty(), "sentinel primary-reboot-down-after-period %s %ld", primary->name, (long)primary->primary_reboot_down_after_period); - rewriteConfigRewriteLine(state, "sentinel master-reboot-down-after-period", line, 1); + rewriteConfigRewriteLine(state, "sentinel primary-reboot-down-after-period", line, 1); /* rewriteConfigMarkAsProcessed is handled after the loop */ } @@ -2184,7 +2186,7 @@ void rewriteConfigSentinelOption(struct rewriteConfigState *state) { rewriteConfigMarkAsProcessed(state, "sentinel known-replica"); rewriteConfigMarkAsProcessed(state, "sentinel known-sentinel"); rewriteConfigMarkAsProcessed(state, "sentinel rename-command"); - rewriteConfigMarkAsProcessed(state, "sentinel master-reboot-down-after-period"); + rewriteConfigMarkAsProcessed(state, "sentinel primary-reboot-down-after-period"); } /* This function uses the config rewriting in order to persist @@ -4249,7 +4251,9 @@ void sentinelSetCommand(client *c) { dictAdd(ri->renamed_commands, oldname, newname); } changes++; - } else if (!strcasecmp(option, "master-reboot-down-after-period") && moreargs > 0) { + } else if ((!strcasecmp(option, "primary-reboot-down-after-period") || + !strcasecmp(option, "master-reboot-down-after-period")) && + moreargs > 0) { /* primary-reboot-down-after-period */ robj *o = c->argv[++j]; if (getLongLongFromObject(o, &ll) == C_ERR || ll < 0) { diff --git a/tests/sentinel/tests/12-master-reboot.tcl b/tests/sentinel/tests/12-master-reboot.tcl index c684d4505d..3d7c7c6ecb 100644 --- a/tests/sentinel/tests/12-master-reboot.tcl +++ b/tests/sentinel/tests/12-master-reboot.tcl @@ -47,9 +47,11 @@ test "Primary reboot in very short time" { R $master_id config rewrite foreach_sentinel_id id { - S $id SENTINEL SET mymaster master-reboot-down-after-period 5000 - S $id sentinel debug ping-period 500 - S $id sentinel debug ask-period 500 + foreach role {master primary} { + S $id SENTINEL SET mymaster $role-reboot-down-after-period 5000 + S $id sentinel debug ping-period 500 + S $id sentinel debug ask-period 500 + } } kill_instance valkey $master_id @@ -100,4 +102,4 @@ test "The old primary eventually gets reconfigured as a slave" { } else { fail "Old master not reconfigured as slave of new master" } -} \ No newline at end of file +}