Parse "recovery_min_apply_delay" from recovery.conf

This commit is contained in:
Ian Barwick
2017-08-25 21:47:14 +09:00
parent 5ee1eb6bf7
commit 5208655a35
3 changed files with 22 additions and 14 deletions

View File

@@ -716,9 +716,8 @@ parse_recovery_conf(const char *data_dir, t_recovery_conf *conf)
strncpy(conf->trigger_file, value, MAXLEN); strncpy(conf->trigger_file, value, MAXLEN);
else if (strcmp(name, "trigger_file") == 0) else if (strcmp(name, "trigger_file") == 0)
strncpy(conf->trigger_file, value, MAXLEN); strncpy(conf->trigger_file, value, MAXLEN);
/* TODO: parse values */ else if (strcmp(name, "recovery_min_apply_delay") == 0)
/*else if (strcmp(name, "recovery_min_apply_delay") == 0) parse_time_unit_parameter(name, value, conf->recovery_min_apply_delay, NULL);
strncpy(conf->, value, MAXLEN);*/
} }
fclose(fp); fclose(fp);
@@ -794,10 +793,13 @@ parse_time_unit_parameter(const char *name, const char *value, char *dest, ItemL
if (targ < 1) if (targ < 1)
{ {
item_list_append_format( if (errors != NULL)
errors, {
_("invalid value provided for \"%s\""), item_list_append_format(
name); errors,
_("invalid value provided for \"%s\""),
name);
}
return; return;
} }
@@ -807,11 +809,14 @@ parse_time_unit_parameter(const char *name, const char *value, char *dest, ItemL
strcmp(ptr, "min") != 0 && strcmp(ptr, "h") != 0 && strcmp(ptr, "min") != 0 && strcmp(ptr, "h") != 0 &&
strcmp(ptr, "d") != 0) strcmp(ptr, "d") != 0)
{ {
item_list_append_format( if (errors != NULL)
errors, {
_("value provided for \"%s\" must be one of ms/s/min/h/d"), item_list_append_format(
name); errors,
return; _("value provided for \"%s\" must be one of ms/s/min/h/d"),
name);
return;
}
} }
} }

View File

@@ -204,7 +204,7 @@ typedef struct
char primary_conninfo[MAXLEN]; char primary_conninfo[MAXLEN];
char primary_slot_name[MAXLEN]; char primary_slot_name[MAXLEN];
char trigger_file[MAXLEN]; char trigger_file[MAXLEN];
int recovery_min_apply_delay; char recovery_min_apply_delay[MAXLEN];
} t_recovery_conf; } t_recovery_conf;
#define T_RECOVERY_CONF_INITIALIZER { \ #define T_RECOVERY_CONF_INITIALIZER { \
@@ -216,7 +216,7 @@ typedef struct
RTA_PAUSE, \ RTA_PAUSE, \
/* standby server settings */ \ /* standby server settings */ \
true, \ true, \
"", "", "", 0 \ "", "", "", "" \
} }

View File

@@ -30,6 +30,9 @@ Changed command line options
The value (defaults to the user in the conninfo string) will be stored in The value (defaults to the user in the conninfo string) will be stored in
the repmgr metadata for use by standby clone/follow.. the repmgr metadata for use by standby clone/follow..
- `--recovery-min-apply-delay` is now a configuration file parameter
`recovery_min_apply_delay, to ensure the setting does not get lost when
a standby follows a new upstream.
### repmgrd ### repmgrd