From: Adrian Klaver <adrian.klaver@aklaver.com>
To: Peter <pmc@citylink.dinoex.sub.org>
To: pgsql-general@lists.postgresql.org
Subject: Re: Something else about Redo Logs disappearing
Date: Mon, 8 Jun 2020 21:21:47 -0700
Message-ID: <c5ae78f9-e922-29bc-379d-739baeb06e2f@aklaver.com> (raw)
In-Reply-To: <20200609023326.GA61487@gate.oper.dinoex.org>
References: <20200609000253.GA21670@gate.oper.dinoex.org>
<d105ee7a-19d5-3207-6311-a1dde37f95f5@aklaver.com>
<20200609023326.GA61487@gate.oper.dinoex.org>
On 6/8/20 7:33 PM, Peter wrote:
>
> Actually, the affair had some good side: as usual I was checking
> my own designs first and looking for flaws, and indeed I found one:
>
> If you do copy out the archive logs not directly to tape, but to
> some disk area for further processing, then there is an issue with
> possible loss. If you do it like the docs say, with a command like
> this:
>
> archive_command = 'test ! -f /mnt/server/archivedir/%f && cp %p
> +/mnt/server/archivedir/%f' # Unix
>
> That "cp" is usually not synchronous. So there is the possibility
> that this command terminates successfully, and reports exitcode zero
> back to the Postgres, and then the Postgres will consider that log
> being safely away.
Which is why just following the above command in the docs is:
"(This is an example, not a recommendation, and might not work on all
platforms.) "
Generally for peace of mind folks use third party tools like:
pg_backrest(https://pgbackrest.org/),
pg_probackup(https://postgrespro.com/products/extensions/pg_probackup)
or Barman(https://www.pgbarman.org/).
as they offer safety checks for your backups.
I use pg_backrest, but it does not look promising for running on BSD:
https://fluca1978.github.io/2019/03/04/pgbackrest_FreeBSD.html
Not sure about pg_probackup.
Barman is Python package:
http://docs.pgbarman.org/release/2.10/#installation-from-sources>
> But the target of the copy may not yet been written to disk. If
> at that point a power loss happens, the log may become missing/damaged/
> incomplete, while the database may or may not consider it done
> when restarting.
>
> Therefore, mounting such a target filesystem in all-synchronous mode
> might be a good idea. (UFS: "-o sync", ZFS: "set sync=always")
>
> cheerio,
> PMc
>
>
--
Adrian Klaver
adrian.klaver@aklaver.com
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 from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-general@postgresql.org
Cc: adrian.klaver@aklaver.com, pmc@citylink.dinoex.sub.org
Subject: Re: Something else about Redo Logs disappearing
In-Reply-To: <c5ae78f9-e922-29bc-379d-739baeb06e2f@aklaver.com>
References: <20200609000253.GA21670@gate.oper.dinoex.org> <d105ee7a-19d5-3207-6311-a1dde37f95f5@aklaver.com> <20200609023326.GA61487@gate.oper.dinoex.org> <c5ae78f9-e922-29bc-379d-739baeb06e2f@aklaver.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