From: Fujii Masao <masao.fujii@oss.nttdata.com>
To: pgsql-hackers@postgresql.org
Subject: pg_basebackup -F plain -R overwrites postgresql.auto.conf
Date: Mon, 10 Feb 2020 16:58:56 +0900
Message-ID: <250dcf2a-94e7-c05e-824a-73cfb38a48a4@oss.nttdata.com> (raw)
Hi,
I found that pg_basebackup -F plain -R *overwrites* postgresql.auto.conf
taken from the primary server with new primary_conninfo setting,
while pg_basebackup -F tar -R just *appends* it into the file. I think that
this is a bug and pg_basebackup -F plain -R should *append* the setting.
Thought?
I attached the patch to fix the bug. This patch should be back-patch to
v12.
Regards,
--
Fujii Masao
NTT DATA CORPORATION
Advanced Platform Technology Group
Research and Development Headquarters
diff --git a/src/fe_utils/recovery_gen.c b/src/fe_utils/recovery_gen.cindex facfb6b1f6..46ca20e20b 100644--- a/src/fe_utils/recovery_gen.c+++ b/src/fe_utils/recovery_gen.c@@ -128,7 +128,7 @@ WriteRecoveryConfig(PGconn *pgconn, char *target_dir, PQExpBuffer contents)
snprintf(filename, MAXPGPATH, "%s/%s", target_dir,
use_recovery_conf ? "recovery.conf" : "postgresql.auto.conf");
- cf = fopen(filename, use_recovery_conf ? "a" : "w");+ cf = fopen(filename, use_recovery_conf ? "w" : "a");
if (cf == NULL)
{
pg_log_error("could not open file \"%s\": %m", filename);
Attachments:
[text/plain] basebackup_append_conninfo.patch (587B, ../250dcf2a-94e7-c05e-824a-73cfb38a48a4@oss.nttdata.com/2-basebackup_append_conninfo.patch)
download | inline diff:diff --git a/src/fe_utils/recovery_gen.c b/src/fe_utils/recovery_gen.cindex facfb6b1f6..46ca20e20b 100644--- a/src/fe_utils/recovery_gen.c+++ b/src/fe_utils/recovery_gen.c@@ -128,7 +128,7 @@ WriteRecoveryConfig(PGconn *pgconn, char *target_dir, PQExpBuffer contents)
snprintf(filename, MAXPGPATH, "%s/%s", target_dir,
use_recovery_conf ? "recovery.conf" : "postgresql.auto.conf");
- cf = fopen(filename, use_recovery_conf ? "a" : "w");+ cf = fopen(filename, use_recovery_conf ? "w" : "a");
if (cf == NULL)
{
pg_log_error("could not open file \"%s\": %m", filename);
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-hackers@postgresql.org
Cc: masao.fujii@oss.nttdata.com
Subject: Re: pg_basebackup -F plain -R overwrites postgresql.auto.conf
In-Reply-To: <250dcf2a-94e7-c05e-824a-73cfb38a48a4@oss.nttdata.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox