mirror of
https://github.com/EnterpriseDB/repmgr.git
synced 2026-03-25 16:16:29 +00:00
Have make_pg_path() output to a PQexpBuffer
Calling functions are all using one anyway, so there's no point keeping static buffers around.
This commit is contained in:
@@ -2733,9 +2733,9 @@ do_node_rejoin(void)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
appendPQExpBuffer(&command,
|
make_pg_path(&command, "pg_rewind");
|
||||||
"%s -D ",
|
appendPQExpBufferStr(&command,
|
||||||
make_pg_path("pg_rewind"));
|
" -D ");
|
||||||
}
|
}
|
||||||
|
|
||||||
appendShellString(&command,
|
appendShellString(&command,
|
||||||
|
|||||||
@@ -6564,9 +6564,11 @@ initialise_direct_clone(t_node_info *local_node_record, t_node_info *upstream_no
|
|||||||
static int
|
static int
|
||||||
run_basebackup(t_node_info *node_record)
|
run_basebackup(t_node_info *node_record)
|
||||||
{
|
{
|
||||||
char script[MAXLEN] = "";
|
|
||||||
int r = SUCCESS;
|
|
||||||
PQExpBufferData params;
|
PQExpBufferData params;
|
||||||
|
PQExpBufferData script;
|
||||||
|
|
||||||
|
int r = SUCCESS;
|
||||||
|
|
||||||
TablespaceListCell *cell = NULL;
|
TablespaceListCell *cell = NULL;
|
||||||
t_basebackup_options backup_options = T_BASEBACKUP_OPTIONS_INITIALIZER;
|
t_basebackup_options backup_options = T_BASEBACKUP_OPTIONS_INITIALIZER;
|
||||||
|
|
||||||
@@ -6717,21 +6719,25 @@ run_basebackup(t_node_info *node_record)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
maxlen_snprintf(script,
|
initPQExpBuffer(&script);
|
||||||
"%s -l \"repmgr base backup\" %s %s",
|
make_pg_path(&script, "pg_basebackup");
|
||||||
make_pg_path("pg_basebackup"),
|
|
||||||
params.data,
|
appendPQExpBuffer(&script,
|
||||||
config_file_options.pg_basebackup_options);
|
" -l \"repmgr base backup\" %s %s",
|
||||||
|
params.data,
|
||||||
|
config_file_options.pg_basebackup_options);
|
||||||
|
|
||||||
termPQExpBuffer(¶ms);
|
termPQExpBuffer(¶ms);
|
||||||
|
|
||||||
log_info(_("executing:\n %s"), script);
|
log_info(_("executing:\n %s"), script.data);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* As of 9.4, pg_basebackup only ever returns 0 or 1
|
* As of 9.4, pg_basebackup only ever returns 0 or 1
|
||||||
*/
|
*/
|
||||||
|
|
||||||
r = system(script);
|
r = system(script.data);
|
||||||
|
|
||||||
|
termPQExpBuffer(&script);
|
||||||
|
|
||||||
if (r != 0)
|
if (r != 0)
|
||||||
return ERR_BAD_BASEBACKUP;
|
return ERR_BAD_BASEBACKUP;
|
||||||
|
|||||||
@@ -262,7 +262,7 @@ extern int copy_remote_files(char *host, char *remote_user, char *remote_path,
|
|||||||
|
|
||||||
extern void print_error_list(ItemList *error_list, int log_level);
|
extern void print_error_list(ItemList *error_list, int log_level);
|
||||||
|
|
||||||
extern char *make_pg_path(const char *file);
|
extern void make_pg_path(PQExpBufferData *buf, const char *file);
|
||||||
|
|
||||||
extern void get_superuser_connection(PGconn **conn, PGconn **superuser_conn, PGconn **privileged_conn);
|
extern void get_superuser_connection(PGconn **conn, PGconn **superuser_conn, PGconn **privileged_conn);
|
||||||
|
|
||||||
|
|||||||
@@ -81,9 +81,7 @@ t_runtime_options runtime_options = T_RUNTIME_OPTIONS_INITIALIZER;
|
|||||||
t_conninfo_param_list source_conninfo = T_CONNINFO_PARAM_LIST_INITIALIZER;
|
t_conninfo_param_list source_conninfo = T_CONNINFO_PARAM_LIST_INITIALIZER;
|
||||||
|
|
||||||
bool config_file_required = true;
|
bool config_file_required = true;
|
||||||
char pg_bindir[MAXLEN] = "";
|
char pg_bindir[MAXPGPATH] = "";
|
||||||
|
|
||||||
char path_buf[MAXLEN] = "";
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* if --node-id/--node-name provided, place that node's record here
|
* if --node-id/--node-name provided, place that node's record here
|
||||||
@@ -3057,7 +3055,6 @@ get_superuser_connection(PGconn **conn, PGconn **superuser_conn, PGconn **privil
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
standy_clone_mode
|
standy_clone_mode
|
||||||
get_standby_clone_mode(void)
|
get_standby_clone_mode(void)
|
||||||
{
|
{
|
||||||
@@ -3072,12 +3069,11 @@ get_standby_clone_mode(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
char *
|
void
|
||||||
make_pg_path(const char *file)
|
make_pg_path(PQExpBufferData *buf, const char *file)
|
||||||
{
|
{
|
||||||
maxlen_snprintf(path_buf, "%s%s", pg_bindir, file);
|
appendPQExpBuffer(buf, "%s%s",
|
||||||
|
pg_bindir, file);
|
||||||
return path_buf;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -3293,9 +3289,10 @@ get_server_action(t_server_action action, char *script, char *data_dir)
|
|||||||
{
|
{
|
||||||
initPQExpBuffer(&command);
|
initPQExpBuffer(&command);
|
||||||
|
|
||||||
|
make_pg_path(&command, "pg_ctl");
|
||||||
|
|
||||||
appendPQExpBuffer(&command,
|
appendPQExpBuffer(&command,
|
||||||
"%s %s -w -D ",
|
" %s -w -D ",
|
||||||
make_pg_path("pg_ctl"),
|
|
||||||
config_file_options.pg_ctl_options);
|
config_file_options.pg_ctl_options);
|
||||||
|
|
||||||
appendShellString(&command,
|
appendShellString(&command,
|
||||||
@@ -3323,9 +3320,10 @@ get_server_action(t_server_action action, char *script, char *data_dir)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
initPQExpBuffer(&command);
|
initPQExpBuffer(&command);
|
||||||
|
make_pg_path(&command, "pg_ctl");
|
||||||
|
|
||||||
appendPQExpBuffer(&command,
|
appendPQExpBuffer(&command,
|
||||||
"%s %s -D ",
|
" %s -D ",
|
||||||
make_pg_path("pg_ctl"),
|
|
||||||
config_file_options.pg_ctl_options);
|
config_file_options.pg_ctl_options);
|
||||||
|
|
||||||
appendShellString(&command,
|
appendShellString(&command,
|
||||||
@@ -3358,9 +3356,11 @@ get_server_action(t_server_action action, char *script, char *data_dir)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
initPQExpBuffer(&command);
|
initPQExpBuffer(&command);
|
||||||
|
|
||||||
|
make_pg_path(&command, "pg_ctl");
|
||||||
|
|
||||||
appendPQExpBuffer(&command,
|
appendPQExpBuffer(&command,
|
||||||
"%s %s -w -D ",
|
" %s -w -D ",
|
||||||
make_pg_path("pg_ctl"),
|
|
||||||
config_file_options.pg_ctl_options);
|
config_file_options.pg_ctl_options);
|
||||||
|
|
||||||
appendShellString(&command,
|
appendShellString(&command,
|
||||||
@@ -3386,9 +3386,11 @@ get_server_action(t_server_action action, char *script, char *data_dir)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
initPQExpBuffer(&command);
|
initPQExpBuffer(&command);
|
||||||
|
|
||||||
|
make_pg_path(&command, "pg_ctl");
|
||||||
|
|
||||||
appendPQExpBuffer(&command,
|
appendPQExpBuffer(&command,
|
||||||
"%s %s -w -D ",
|
" %s -w -D ",
|
||||||
make_pg_path("pg_ctl"),
|
|
||||||
config_file_options.pg_ctl_options);
|
config_file_options.pg_ctl_options);
|
||||||
|
|
||||||
appendShellString(&command,
|
appendShellString(&command,
|
||||||
@@ -3415,9 +3417,11 @@ get_server_action(t_server_action action, char *script, char *data_dir)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
initPQExpBuffer(&command);
|
initPQExpBuffer(&command);
|
||||||
|
|
||||||
|
make_pg_path(&command, "pg_ctl");
|
||||||
|
|
||||||
appendPQExpBuffer(&command,
|
appendPQExpBuffer(&command,
|
||||||
"%s %s -w -D ",
|
" %s -w -D ",
|
||||||
make_pg_path("pg_ctl"),
|
|
||||||
config_file_options.pg_ctl_options);
|
config_file_options.pg_ctl_options);
|
||||||
|
|
||||||
appendShellString(&command,
|
appendShellString(&command,
|
||||||
|
|||||||
Reference in New Issue
Block a user