mirror of
https://github.com/EnterpriseDB/repmgr.git
synced 2026-03-26 16:46:28 +00:00
Add new option pg_restore_command.
This can be used so that repmgr standby clone adds the string specified in repmgr.conf as a restore_command in recovery.conf. We can use this option for integration with barman by setting the parameter to an appropriate get-wal call.
This commit is contained in:
6
config.c
6
config.c
@@ -224,6 +224,7 @@ parse_config(t_configuration_options *options)
|
|||||||
memset(options->pg_bindir, 0, sizeof(options->pg_bindir));
|
memset(options->pg_bindir, 0, sizeof(options->pg_bindir));
|
||||||
memset(options->pg_ctl_options, 0, sizeof(options->pg_ctl_options));
|
memset(options->pg_ctl_options, 0, sizeof(options->pg_ctl_options));
|
||||||
memset(options->pg_basebackup_options, 0, sizeof(options->pg_basebackup_options));
|
memset(options->pg_basebackup_options, 0, sizeof(options->pg_basebackup_options));
|
||||||
|
memset(options->pg_restore_command, 0, sizeof(options->pg_restore_command));
|
||||||
|
|
||||||
/* default master_response_timeout is 60 seconds */
|
/* default master_response_timeout is 60 seconds */
|
||||||
options->master_response_timeout = 60;
|
options->master_response_timeout = 60;
|
||||||
@@ -340,7 +341,8 @@ parse_config(t_configuration_options *options)
|
|||||||
strncpy(options->follow_command, value, MAXLEN);
|
strncpy(options->follow_command, value, MAXLEN);
|
||||||
else if (strcmp(name, "master_response_timeout") == 0)
|
else if (strcmp(name, "master_response_timeout") == 0)
|
||||||
options->master_response_timeout = repmgr_atoi(value, "master_response_timeout", &config_errors, false);
|
options->master_response_timeout = repmgr_atoi(value, "master_response_timeout", &config_errors, false);
|
||||||
/* 'primary_response_timeout' as synonym for 'master_response_timeout' -
|
/*
|
||||||
|
* 'primary_response_timeout' as synonym for 'master_response_timeout' -
|
||||||
* we'll switch terminology in a future release (3.1?)
|
* we'll switch terminology in a future release (3.1?)
|
||||||
*/
|
*/
|
||||||
else if (strcmp(name, "primary_response_timeout") == 0)
|
else if (strcmp(name, "primary_response_timeout") == 0)
|
||||||
@@ -372,6 +374,8 @@ parse_config(t_configuration_options *options)
|
|||||||
parse_event_notifications_list(options, value);
|
parse_event_notifications_list(options, value);
|
||||||
else if (strcmp(name, "tablespace_mapping") == 0)
|
else if (strcmp(name, "tablespace_mapping") == 0)
|
||||||
tablespace_list_append(options, value);
|
tablespace_list_append(options, value);
|
||||||
|
else if (strcmp(name, "pg_restore_command") == 0)
|
||||||
|
strncpy(options->pg_restore_command, value, MAXLEN);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
known_parameter = false;
|
known_parameter = false;
|
||||||
|
|||||||
3
config.h
3
config.h
@@ -72,6 +72,7 @@ typedef struct
|
|||||||
char pg_bindir[MAXLEN];
|
char pg_bindir[MAXLEN];
|
||||||
char pg_ctl_options[MAXLEN];
|
char pg_ctl_options[MAXLEN];
|
||||||
char pg_basebackup_options[MAXLEN];
|
char pg_basebackup_options[MAXLEN];
|
||||||
|
char pg_restore_command[MAXLEN];
|
||||||
char logfile[MAXLEN];
|
char logfile[MAXLEN];
|
||||||
int monitor_interval_secs;
|
int monitor_interval_secs;
|
||||||
int retry_promote_interval_secs;
|
int retry_promote_interval_secs;
|
||||||
@@ -82,7 +83,7 @@ typedef struct
|
|||||||
TablespaceList tablespace_mapping;
|
TablespaceList tablespace_mapping;
|
||||||
} t_configuration_options;
|
} t_configuration_options;
|
||||||
|
|
||||||
#define T_CONFIGURATION_OPTIONS_INITIALIZER { "", -1, NO_UPSTREAM_NODE, "", MANUAL_FAILOVER, -1, "", "", "", "", "", "", "", -1, -1, -1, "", "", "", "", 0, 0, 0, 0, "", { NULL, NULL }, {NULL, NULL} }
|
#define T_CONFIGURATION_OPTIONS_INITIALIZER { "", -1, NO_UPSTREAM_NODE, "", MANUAL_FAILOVER, -1, "", "", "", "", "", "", "", -1, -1, -1, "", "", "", "", "", 0, 0, 0, 0, "", { NULL, NULL }, {NULL, NULL} }
|
||||||
|
|
||||||
typedef struct ErrorListCell
|
typedef struct ErrorListCell
|
||||||
{
|
{
|
||||||
|
|||||||
9
repmgr.c
9
repmgr.c
@@ -4219,6 +4219,15 @@ create_recovery_file(const char *data_dir)
|
|||||||
log_debug(_("recovery.conf: %s"), line);
|
log_debug(_("recovery.conf: %s"), line);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* If pg_restore_command is set, we use it as resore_cmmand in recovery.conf */
|
||||||
|
if (strcmp(options.pg_restore_command, "") != 0)
|
||||||
|
{
|
||||||
|
maxlen_snprintf(line, "restore_command = '%s'\n",
|
||||||
|
options.pg_restore_command);
|
||||||
|
if (write_recovery_file_line(recovery_file, recovery_file_path, line) == false)
|
||||||
|
return false;
|
||||||
|
log_debug(_("recovery.conf: %s"), line);
|
||||||
|
}
|
||||||
fclose(recovery_file);
|
fclose(recovery_file);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
@@ -113,6 +113,10 @@
|
|||||||
#
|
#
|
||||||
# tablespace_mapping=/path/to/original/tablespace=/path/to/new/tablespace
|
# tablespace_mapping=/path/to/original/tablespace=/path/to/new/tablespace
|
||||||
|
|
||||||
|
# You can specify a restore_command to be used in the recovery.conf that
|
||||||
|
# will be placed in the cloned standby
|
||||||
|
#
|
||||||
|
# pg_resore_command = cp /path/to/archived/wals/%f %p
|
||||||
|
|
||||||
# Failover settings (repmgrd)
|
# Failover settings (repmgrd)
|
||||||
# ---------------------------
|
# ---------------------------
|
||||||
|
|||||||
Reference in New Issue
Block a user