mirror of
https://github.com/EnterpriseDB/repmgr.git
synced 2026-03-26 16:46:28 +00:00
Use make_remote_repmgr_path() in place of make_repmgr_path()
Also we can now simplify "cluster (matrix|crosscheck)" commands as beginning with v4.0, we know where the configuration file is, so can provide that when invoking repmgr remotely.
This commit is contained in:
@@ -960,7 +960,7 @@ build_cluster_matrix(t_node_matrix_rec ***matrix_rec_dest, int *name_length)
|
|||||||
|
|
||||||
host = param_get(&remote_conninfo, "host");
|
host = param_get(&remote_conninfo, "host");
|
||||||
|
|
||||||
node_conn = establish_db_connection(cell->node_info->conninfo, false);
|
node_conn = establish_db_connection_quiet(cell->node_info->conninfo);
|
||||||
|
|
||||||
connection_status =
|
connection_status =
|
||||||
(PQstatus(node_conn) == CONNECTION_OK) ? 0 : -1;
|
(PQstatus(node_conn) == CONNECTION_OK) ? 0 : -1;
|
||||||
@@ -997,24 +997,12 @@ build_cluster_matrix(t_node_matrix_rec ***matrix_rec_dest, int *name_length)
|
|||||||
* remote repmgr - those are the only values it needs to work, and
|
* remote repmgr - those are the only values it needs to work, and
|
||||||
* saves us making assumptions about the location of repmgr.conf
|
* saves us making assumptions about the location of repmgr.conf
|
||||||
*/
|
*/
|
||||||
appendPQExpBuffer(&command,
|
appendPQExpBufferChar(&command, '"');
|
||||||
"\"%s -d '%s' ",
|
|
||||||
make_repmgr_path(progname()),
|
|
||||||
cell->node_info->conninfo);
|
|
||||||
|
|
||||||
|
make_remote_repmgr_path(&command, cell->node_info);
|
||||||
|
|
||||||
if (strlen(pg_bindir))
|
appendPQExpBufferStr(&command,
|
||||||
{
|
" cluster show --csv -L NOTICE --terse\"");
|
||||||
appendPQExpBuffer(&command,
|
|
||||||
"--pg_bindir=");
|
|
||||||
appendShellString(&command,
|
|
||||||
pg_bindir);
|
|
||||||
appendPQExpBuffer(&command,
|
|
||||||
" ");
|
|
||||||
}
|
|
||||||
|
|
||||||
appendPQExpBuffer(&command,
|
|
||||||
" cluster show --csv\"");
|
|
||||||
|
|
||||||
log_verbose(LOG_DEBUG, "build_cluster_matrix(): executing:\n %s", command.data);
|
log_verbose(LOG_DEBUG, "build_cluster_matrix(): executing:\n %s", command.data);
|
||||||
|
|
||||||
@@ -1180,24 +1168,10 @@ build_cluster_crosscheck(t_node_status_cube ***dest_cube, int *name_length)
|
|||||||
|
|
||||||
initPQExpBuffer(&command);
|
initPQExpBuffer(&command);
|
||||||
|
|
||||||
appendPQExpBuffer(&command,
|
make_remote_repmgr_path(&command, cell->node_info);
|
||||||
"%s -d '%s' --node-id=%i ",
|
|
||||||
make_repmgr_path(progname()),
|
|
||||||
cell->node_info->conninfo,
|
|
||||||
remote_node_id);
|
|
||||||
|
|
||||||
if (strlen(pg_bindir))
|
appendPQExpBufferStr(&command,
|
||||||
{
|
" cluster matrix --csv -L NOTICE --terse");
|
||||||
appendPQExpBuffer(&command,
|
|
||||||
"--pg_bindir=");
|
|
||||||
appendShellString(&command,
|
|
||||||
pg_bindir);
|
|
||||||
appendPQExpBuffer(&command,
|
|
||||||
" ");
|
|
||||||
}
|
|
||||||
|
|
||||||
appendPQExpBuffer(&command,
|
|
||||||
"cluster matrix --csv 2>/dev/null");
|
|
||||||
|
|
||||||
initPQExpBuffer(&command_output);
|
initPQExpBuffer(&command_output);
|
||||||
|
|
||||||
|
|||||||
@@ -231,7 +231,6 @@ 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 char *make_pg_path(const char *file);
|
||||||
extern char *make_repmgr_path(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);
|
||||||
|
|
||||||
|
|||||||
@@ -2483,22 +2483,6 @@ make_pg_path(const char *file)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
char *
|
|
||||||
make_repmgr_path(const char *file)
|
|
||||||
{
|
|
||||||
if (config_file_options.repmgr_bindir[0] != '\0')
|
|
||||||
{
|
|
||||||
maxlen_snprintf(path_buf, "%s%s", config_file_options.repmgr_bindir, file);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
maxlen_snprintf(path_buf, "%s%s", pg_bindir, file);
|
|
||||||
}
|
|
||||||
|
|
||||||
return path_buf;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
int
|
int
|
||||||
copy_remote_files(char *host, char *remote_user, char *remote_path,
|
copy_remote_files(char *host, char *remote_user, char *remote_path,
|
||||||
char *local_path, bool is_directory, int server_version_num)
|
char *local_path, bool is_directory, int server_version_num)
|
||||||
@@ -2688,9 +2672,28 @@ remote_command(const char *host, const char *user, const char *command, PQExpBuf
|
|||||||
void
|
void
|
||||||
make_remote_repmgr_path(PQExpBufferData *output_buf, t_node_info *remote_node_record)
|
make_remote_repmgr_path(PQExpBufferData *output_buf, t_node_info *remote_node_record)
|
||||||
{
|
{
|
||||||
|
if (config_file_options.repmgr_bindir[0] != '\0')
|
||||||
|
{
|
||||||
|
int len = strlen(config_file_options.repmgr_bindir);
|
||||||
|
|
||||||
|
appendPQExpBufferStr(output_buf,
|
||||||
|
config_file_options.repmgr_bindir);
|
||||||
|
|
||||||
|
/* Add trailing slash */
|
||||||
|
if (config_file_options.repmgr_bindir[len - 1] != '/')
|
||||||
|
{
|
||||||
|
appendPQExpBufferChar(output_buf, '/');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (pg_bindir[0] != '\0')
|
||||||
|
{
|
||||||
|
appendPQExpBufferStr(output_buf,
|
||||||
|
pg_bindir);
|
||||||
|
}
|
||||||
|
|
||||||
appendPQExpBuffer(output_buf,
|
appendPQExpBuffer(output_buf,
|
||||||
"%s -f %s ",
|
"%s -f %s ",
|
||||||
make_repmgr_path(progname()),
|
progname(),
|
||||||
remote_node_record->config_file);
|
remote_node_record->config_file);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user