mirror of
https://github.com/EnterpriseDB/repmgr.git
synced 2026-03-26 16:46:28 +00:00
Handle "event_notifications" when reloading configuration
This commit is contained in:
38
configfile.c
38
configfile.c
@@ -22,6 +22,8 @@ static bool parse_bool(const char *s,
|
|||||||
|
|
||||||
static void _parse_line(char *buf, char *name, char *value);
|
static void _parse_line(char *buf, char *name, char *value);
|
||||||
static void parse_event_notifications_list(t_configuration_options *options, const char *arg);
|
static void parse_event_notifications_list(t_configuration_options *options, const char *arg);
|
||||||
|
static void clear_event_notification_list(t_configuration_options *options);
|
||||||
|
|
||||||
static void parse_time_unit_parameter(const char *name, const char *value, char *dest, ItemList *errors);
|
static void parse_time_unit_parameter(const char *name, const char *value, char *dest, ItemList *errors);
|
||||||
|
|
||||||
static void tablespace_list_append(t_configuration_options *options, const char *arg);
|
static void tablespace_list_append(t_configuration_options *options, const char *arg);
|
||||||
@@ -470,7 +472,11 @@ _parse_config(t_configuration_options *options, ItemList *error_list, ItemList *
|
|||||||
else if (strcmp(name, "event_notification_command") == 0)
|
else if (strcmp(name, "event_notification_command") == 0)
|
||||||
strncpy(options->event_notification_command, value, MAXLEN);
|
strncpy(options->event_notification_command, value, MAXLEN);
|
||||||
else if (strcmp(name, "event_notifications") == 0)
|
else if (strcmp(name, "event_notifications") == 0)
|
||||||
|
{
|
||||||
|
/* store unparsed value for comparison when reloading config */
|
||||||
|
strncpy(options->event_notifications_orig, value, MAXLEN);
|
||||||
parse_event_notifications_list(options, value);
|
parse_event_notifications_list(options, value);
|
||||||
|
}
|
||||||
|
|
||||||
/* barman settings */
|
/* barman settings */
|
||||||
else if (strcmp(name, "barman_host") == 0)
|
else if (strcmp(name, "barman_host") == 0)
|
||||||
@@ -954,10 +960,13 @@ reload_config(t_configuration_options *orig_options)
|
|||||||
config_changed = true;
|
config_changed = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* event_notification_command */
|
/* event_notifications */
|
||||||
// XXX store original string for comparison
|
if (strcmp(orig_options->event_notifications_orig, new_options.event_notifications_orig) == 0)
|
||||||
//else if (strcmp(name, "event_notifications") == 0)
|
{
|
||||||
//parse_event_notifications_list(options, value);
|
strncpy(orig_options->event_notifications_orig, new_options.event_notifications_orig, MAXLEN);
|
||||||
|
clear_event_notification_list(orig_options);
|
||||||
|
orig_options->event_notifications = new_options.event_notifications;
|
||||||
|
}
|
||||||
|
|
||||||
/* failover */
|
/* failover */
|
||||||
if (orig_options->failover != new_options.failover)
|
if (orig_options->failover != new_options.failover)
|
||||||
@@ -1322,7 +1331,6 @@ parse_event_notifications_list(t_configuration_options *options, const char *arg
|
|||||||
char event_type_buf[MAXLEN] = "";
|
char event_type_buf[MAXLEN] = "";
|
||||||
char *dst_ptr = event_type_buf;
|
char *dst_ptr = event_type_buf;
|
||||||
|
|
||||||
|
|
||||||
for (arg_ptr = arg; arg_ptr <= (arg + strlen(arg)); arg_ptr++)
|
for (arg_ptr = arg; arg_ptr <= (arg + strlen(arg)); arg_ptr++)
|
||||||
{
|
{
|
||||||
/* ignore whitespace */
|
/* ignore whitespace */
|
||||||
@@ -1376,6 +1384,26 @@ parse_event_notifications_list(t_configuration_options *options, const char *arg
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static void
|
||||||
|
clear_event_notification_list(t_configuration_options *options)
|
||||||
|
{
|
||||||
|
if (options->event_notifications.head != NULL)
|
||||||
|
{
|
||||||
|
EventNotificationListCell *cell;
|
||||||
|
EventNotificationListCell *next_cell;
|
||||||
|
|
||||||
|
cell = options->event_notifications.head;
|
||||||
|
|
||||||
|
while (cell != NULL)
|
||||||
|
{
|
||||||
|
next_cell = cell->next;
|
||||||
|
pfree(cell);
|
||||||
|
cell = next_cell;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
bool
|
bool
|
||||||
parse_pg_basebackup_options(const char *pg_basebackup_options, t_basebackup_options *backup_options, int server_version_num, ItemList *error_list)
|
parse_pg_basebackup_options(const char *pg_basebackup_options, t_basebackup_options *backup_options, int server_version_num, ItemList *error_list)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -112,6 +112,7 @@ typedef struct
|
|||||||
|
|
||||||
/* event notification settings */
|
/* event notification settings */
|
||||||
char event_notification_command[MAXLEN];
|
char event_notification_command[MAXLEN];
|
||||||
|
char event_notifications_orig[MAXLEN];
|
||||||
EventNotificationList event_notifications;
|
EventNotificationList event_notifications;
|
||||||
|
|
||||||
/* barman settings */
|
/* barman settings */
|
||||||
@@ -152,7 +153,7 @@ typedef struct
|
|||||||
/* service settings */ \
|
/* service settings */ \
|
||||||
"", "", "", "", "", "", \
|
"", "", "", "", "", "", \
|
||||||
/* event notification settings */ \
|
/* event notification settings */ \
|
||||||
"", { NULL, NULL }, \
|
"", "", { NULL, NULL }, \
|
||||||
/* barman settings */ \
|
/* barman settings */ \
|
||||||
"", "", "", \
|
"", "", "", \
|
||||||
/* undocumented test settings */ \
|
/* undocumented test settings */ \
|
||||||
|
|||||||
Reference in New Issue
Block a user