mirror of
https://github.com/EnterpriseDB/repmgr.git
synced 2026-03-25 08:06:29 +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:
20
dbutils.c
20
dbutils.c
@@ -527,9 +527,14 @@ param_get(t_conninfo_param_list *param_list, const char *param)
|
||||
* Parse a conninfo string into a t_conninfo_param_list
|
||||
*
|
||||
* See conn_to_param_list() to do the same for a PQconn
|
||||
*
|
||||
* "ignore_local_params": ignores those parameters specific
|
||||
* to a local installation, i.e. when parsing an upstream
|
||||
* node's conninfo string for inclusion into "primary_conninfo",
|
||||
* don't copy that node's values
|
||||
*/
|
||||
bool
|
||||
parse_conninfo_string(const char *conninfo_str, t_conninfo_param_list *param_list, char *errmsg, bool ignore_application_name)
|
||||
parse_conninfo_string(const char *conninfo_str, t_conninfo_param_list *param_list, char *errmsg, bool ignore_local_params)
|
||||
{
|
||||
PQconninfoOption *connOptions;
|
||||
PQconninfoOption *option;
|
||||
@@ -541,14 +546,21 @@ parse_conninfo_string(const char *conninfo_str, t_conninfo_param_list *param_lis
|
||||
|
||||
for (option = connOptions; option && option->keyword; option++)
|
||||
{
|
||||
/* Ignore non-set or blank parameter values*/
|
||||
/* Ignore non-set or blank parameter values */
|
||||
if ((option->val == NULL) ||
|
||||
(option->val != NULL && option->val[0] == '\0'))
|
||||
continue;
|
||||
|
||||
/* Ignore application_name */
|
||||
if (ignore_application_name == true && strcmp(option->keyword, "application_name") == 0)
|
||||
continue;
|
||||
if (ignore_local_params == true)
|
||||
{
|
||||
if (strcmp(option->keyword, "application_name") == 0)
|
||||
continue;
|
||||
if (strcmp(option->keyword, "passfile") == 0)
|
||||
continue;
|
||||
if (strcmp(option->keyword, "servicefile") == 0)
|
||||
continue;
|
||||
}
|
||||
|
||||
param_set(param_list, option->keyword, option->val);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user