mirror of
https://github.com/EnterpriseDB/repmgr.git
synced 2026-03-26 00:26:30 +00:00
Standardize "primary_conninfo" generation
Previously repmgr would write all the default libpq parameters
into "primary_conninfo" on "standby clone", but not for
"standby follow", which is inconsistent.
For repmgr4 we'll determine that the upstream node's conninfo
must be canonical and contain all required connection parameters,
even if these are available as defaults or environment variables
in the local environment, as those are transient and may not
be available in all environments/situations.
recovery.conf's "primary_conninfo" will be generated using the
upstream's conninfo parameters, except for those specific
to the downstream node. These are:
- "application_name": this will always be set to the
"node_name" of the downstream node
- "passfile" and "servicefile": these, must of course
reference files on the downstream node so will be extracted
from the downstream node's conninfo, if set
This commit is contained in:
@@ -111,7 +111,7 @@ main(int argc, char **argv)
|
||||
* when the connection is made.
|
||||
*/
|
||||
|
||||
initialize_conninfo_params(&source_conninfo, true);
|
||||
initialize_conninfo_params(&source_conninfo, false);
|
||||
|
||||
for (c = 0; c < source_conninfo.size && source_conninfo.keywords[c]; c++)
|
||||
{
|
||||
@@ -2433,7 +2433,8 @@ copy_remote_files(char *host, char *remote_user, char *remote_path,
|
||||
* Creates a recovery.conf file for a standby
|
||||
*
|
||||
* A database connection pointer is required for escaping primary_conninfo
|
||||
* parameters. When cloning from Barman and --no-upstream-connection ) this might not be
|
||||
* parameters. When cloning from Barman and --no-upstream-connection ) this
|
||||
* might not be available.
|
||||
*/
|
||||
bool
|
||||
create_recovery_file(t_node_info *node_record, t_conninfo_param_list *recovery_conninfo, const char *data_dir)
|
||||
@@ -2572,12 +2573,15 @@ write_primary_conninfo(char *line, t_conninfo_param_list *param_list)
|
||||
*/
|
||||
if (strcmp(param_list->keywords[c], "dbname") == 0 ||
|
||||
strcmp(param_list->keywords[c], "replication") == 0 ||
|
||||
(runtime_options.use_recovery_conninfo_password == false &&
|
||||
strcmp(param_list->keywords[c], "password") == 0) ||
|
||||
(param_list->values[c] == NULL) ||
|
||||
(param_list->values[c] != NULL && param_list->values[c][0] == '\0'))
|
||||
continue;
|
||||
|
||||
/* only include "password" if explicitly requested */
|
||||
if (runtime_options.use_recovery_conninfo_password == false &&
|
||||
strcmp(param_list->keywords[c], "password") == 0)
|
||||
continue;
|
||||
|
||||
if (conninfo_buf.len != 0)
|
||||
appendPQExpBufferChar(&conninfo_buf, ' ');
|
||||
|
||||
|
||||
Reference in New Issue
Block a user