mirror of
https://github.com/EnterpriseDB/repmgr.git
synced 2026-03-27 17:06:29 +00:00
Prevent duplicated parameters being passed to pg_basebackup
This was not a problem, but ugly.
This commit is contained in:
42
repmgr.c
42
repmgr.c
@@ -4623,33 +4623,37 @@ run_basebackup(const char *data_dir, int server_version)
|
|||||||
|
|
||||||
appendPQExpBuffer(¶ms, " -D %s", data_dir);
|
appendPQExpBuffer(¶ms, " -D %s", data_dir);
|
||||||
|
|
||||||
if (opts != NULL && strlen(runtime_options.dbname))
|
/*
|
||||||
|
* conninfo string provided - pass it to pg_basebackup as the -d option
|
||||||
|
* (pg_basebackup doesn't require or want a database name, but for
|
||||||
|
* consistency with other applications accepts a conninfo string
|
||||||
|
* under -d/--dbname)
|
||||||
|
*/
|
||||||
|
if (conninfo_provided == true)
|
||||||
{
|
{
|
||||||
appendPQExpBuffer(¶ms, " -d '%s'", runtime_options.dbname);
|
appendPQExpBuffer(¶ms, " -d '%s'", runtime_options.dbname);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (strlen(runtime_options.host))
|
|
||||||
{
|
|
||||||
appendPQExpBuffer(¶ms, " -h %s", runtime_options.host);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* XXX -p and -U will be duplicated if provided in conninfo string
|
* Connection parameters not passed to repmgr as conninfo string - provide
|
||||||
* but not as explict repmgr command line parameters, e.g.:
|
* them individually to pg_basebackup (-d/--dbname not required)
|
||||||
*
|
|
||||||
* pg_basebackup -l "repmgr base backup" -d 'host=localhost port=5501 dbname=repmgr user=repmgr' -p 5501 -U repmgr -X stream
|
|
||||||
*
|
|
||||||
* this is ugly but harmless; we should fix it some time
|
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
if (strlen(runtime_options.masterport))
|
if (conninfo_provided == false)
|
||||||
{
|
{
|
||||||
appendPQExpBuffer(¶ms, " -p %s", runtime_options.masterport);
|
if (strlen(runtime_options.host))
|
||||||
}
|
{
|
||||||
|
appendPQExpBuffer(¶ms, " -h %s", runtime_options.host);
|
||||||
|
}
|
||||||
|
|
||||||
if (strlen(runtime_options.username))
|
if (strlen(runtime_options.masterport))
|
||||||
{
|
{
|
||||||
appendPQExpBuffer(¶ms, " -U %s", runtime_options.username);
|
appendPQExpBuffer(¶ms, " -p %s", runtime_options.masterport);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (strlen(runtime_options.username))
|
||||||
|
{
|
||||||
|
appendPQExpBuffer(¶ms, " -U %s", runtime_options.username);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (runtime_options.fast_checkpoint) {
|
if (runtime_options.fast_checkpoint) {
|
||||||
|
|||||||
Reference in New Issue
Block a user