mirror of
https://github.com/EnterpriseDB/repmgr.git
synced 2026-03-23 07:06:30 +00:00
Add a new standby_name parameter that, when provided in repmgr.conf,
is included in the primary_conninfo as application_name... This is a simple first step towards making repmgr works fine with 9.1 and sync standbys
This commit is contained in:
4
config.c
4
config.c
@@ -37,6 +37,7 @@ parse_config(const char *config_file, t_configuration_options *options)
|
||||
memset(options->conninfo, 0, sizeof(options->conninfo));
|
||||
options->failover = MANUAL_FAILOVER;
|
||||
options->priority = 0;
|
||||
memset(options->standby_name, 0, sizeof(options->standby_name));
|
||||
memset(options->promote_command, 0, sizeof(options->promote_command));
|
||||
memset(options->follow_command, 0, sizeof(options->follow_command));
|
||||
memset(options->rsync_options, 0, sizeof(options->rsync_options));
|
||||
@@ -91,6 +92,8 @@ parse_config(const char *config_file, t_configuration_options *options)
|
||||
}
|
||||
else if (strcmp(name, "priority") == 0)
|
||||
options->priority = atoi(value);
|
||||
else if (strcmp(name, "standby_name") == 0)
|
||||
strncpy(options->standby_name, value, MAXLEN);
|
||||
else if (strcmp(name, "promote_command") == 0)
|
||||
strncpy(options->promote_command, value, MAXLEN);
|
||||
else if (strcmp(name, "follow_command") == 0)
|
||||
@@ -221,6 +224,7 @@ reload_configuration(char *config_file, t_configuration_options *orig_options)
|
||||
strcpy(orig_options->conninfo, new_options.conninfo);
|
||||
orig_options->failover = new_options.failover;
|
||||
orig_options->priority = new_options.priority;
|
||||
strcpy(orig_options->standby_name, new_options.standby_name);
|
||||
strcpy(orig_options->promote_command, new_options.promote_command);
|
||||
strcpy(orig_options->follow_command, new_options.follow_command);
|
||||
strcpy(orig_options->rsync_options, new_options.rsync_options);
|
||||
|
||||
1
config.h
1
config.h
@@ -30,6 +30,7 @@ typedef struct
|
||||
char conninfo[MAXLEN];
|
||||
int failover;
|
||||
int priority;
|
||||
char standby_name[MAXLEN];
|
||||
char promote_command[MAXLEN];
|
||||
char follow_command[MAXLEN];
|
||||
char loglevel[MAXLEN];
|
||||
|
||||
10
repmgr.c
10
repmgr.c
@@ -2065,6 +2065,7 @@ write_primary_conninfo(char* line)
|
||||
char host_buf[MAXLEN] = "";
|
||||
char conn_buf[MAXLEN] = "";
|
||||
char user_buf[MAXLEN] = "";
|
||||
char appname_buff[MAXLEN] = "";
|
||||
char password_buf[MAXLEN] = "";
|
||||
|
||||
/* Environment variable for password (UGLY, please use .pgpass!) */
|
||||
@@ -2086,8 +2087,13 @@ write_primary_conninfo(char* line)
|
||||
maxlen_snprintf(user_buf, " user=%s", runtime_options.username);
|
||||
}
|
||||
|
||||
maxlen_snprintf(conn_buf, "port=%s%s%s%s",
|
||||
(runtime_options.masterport[0]) ? runtime_options.masterport : "5432", host_buf, user_buf, password_buf);
|
||||
if (options.standby_name[0]) {
|
||||
maxlen_snprintf(appname_buff, " application_name=%s", options.standby_name);
|
||||
}
|
||||
|
||||
maxlen_snprintf(conn_buf, "port=%s%s%s%s%s",
|
||||
(runtime_options.masterport[0]) ? runtime_options.masterport : "5432", host_buf, user_buf, password_buf,
|
||||
appname_buf);
|
||||
|
||||
maxlen_snprintf(line, "primary_conninfo = '%s'", conn_buf);
|
||||
|
||||
|
||||
@@ -7,6 +7,7 @@ cluster=test
|
||||
|
||||
# Node ID
|
||||
node=2
|
||||
standby_name=standby2
|
||||
|
||||
# Connection information
|
||||
conninfo='host=192.168.204.104'
|
||||
|
||||
Reference in New Issue
Block a user