Replace master-reboot-down-after-period with primary-reboot-down-after-period in sentinel.conf (#647)
Update sentinel.conf config parameter, From: SENTINEL master-reboot-down-after-period mymaster 0 To: SENTINEL primary-reboot-down-after-period myprimary 0 But we still keep the backward compatibility, clients could use SENTINEL master-reboot-down-after-period mymaster 0 OR SENTINEL primary-reboot-down-after-period myprimary 0 --------- Signed-off-by: hwware <wen.hui.ware@gmail.com>
This commit is contained in:
parent
dd4bd5065b
commit
1a8bd045f3
@ -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
|
||||
|
@ -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 <name> <milliseconds> */
|
||||
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 <milliseconds> */
|
||||
robj *o = c->argv[++j];
|
||||
if (getLongLongFromObject(o, &ll) == C_ERR || ll < 0) {
|
||||
|
@ -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"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user