Re: [PATCH] Make pg_basebackup configure and start standby [Review] - Mailing list pgsql-hackers

From Boszormenyi Zoltan
Subject Re: [PATCH] Make pg_basebackup configure and start standby [Review]
Date
Msg-id 507AA4D3.3050000@cybertec.at
Whole thread Raw
In response to Re: [PATCH] Make pg_basebackup configure and start standby [Review]  (Robert Haas <robertmhaas@gmail.com>)
Responses Re: [PATCH] Make pg_basebackup configure and start standby [Review]  (Fujii Masao <masao.fujii@gmail.com>)
List pgsql-hackers
2012-10-12 22:21 keltezéssel, Robert Haas írta:
> On Wed, Oct 10, 2012 at 8:02 PM, Fujii Masao <masao.fujii@gmail.com> wrote:
>> On Thu, Oct 11, 2012 at 3:36 AM, Boszormenyi Zoltan <zb@cybertec.at> wrote:
>>> 2012-10-10 18:23 keltezéssel, Fujii Masao írta:
>>>> When tar output format is specified together with -R option, recovery.conf
>>>> is
>>>> not included in base.tar. I think it should.
>>>
>>> Why? This patch only promises to write the recovery.conf into the
>>> directory specified with -D.
>> Because it's more user-friendly. If recovery.conf is not included in base.tar,
>> when base.tar is extracted to disk to use the backup, a user always needs
>> to copy recovery.conf to the extracted directory. OTOH if it's included in
>> base.tar, such copy operation is not required and we can simplify the
>> procedures to use the backup a bit.
> +1.

OK, out of popular demand, I implemented writing into the base.tar
if both -R and -Ft was specified.

The code to create a tar header and the checksum inside the header
was copied from bin/pg_dump/pg_backup_tar.c.

I tested these scenarios ("server" can be either a master and standby):
- backup a server with -Fp
    (no recovery.conf in the target directory was written)
- backup a server with -Ftar
    (no recovery.conf was written into the target directory or base.tar)
- backup a server with -Ftar -z
    (no recovery.conf was written into the target directory or base.tar.gz)
- backup a server with -R -Fp
    (the new recovery.conf was written into the target directory)
- backup a server with -R -Ftar
    (the new recovery.conf was written into the base.tar)
- backup a server with -R -Ftar -z
    (the new recovery.conf was written into the base.tar.gz)

Backing up a standby server without -R preserves the original recovery.conf of the
standby, it points to the standby's source server.

Backing up a standby server with -R overwrites the original recovery.conf with the new
one pointing to the standby instead of the standby's source server. Without -Ft, it is
obvious. With -Ft, there are two recovery.conf files in the tar file and upon extracting it,
the last written one (the one generated via -R) overwrites the original.

Best regards,
Zoltán Böszörményi

--
----------------------------------
Zoltán Böszörményi
Cybertec Schönig & Schönig GmbH
Gröhrmühlgasse 26
A-2700 Wiener Neustadt, Austria
Web: http://www.postgresql-support.de
      http://www.postgresql.at/


Attachment

pgsql-hackers by date:

Previous
From: Satoshi Nagayasu
Date:
Subject: Re: pg_stat_lwlocks view - lwlocks statistics, round 2
Next
From: Simon Riggs
Date:
Subject: Deprecating Hash Indexes