public inbox for [email protected]
help / color / mirror / Atom feedFrom: Dario Pudlo <[email protected]>
To: [email protected]
To: [email protected]
Subject: Re: Regarding the archive_command in "continuois archiving" chapter.
Date: Thu, 4 Jun 2026 12:00:43 -0300
Message-ID: <CAONoTPYq+9H_1A+LLRujxVSAikaduFn-PYXDzKyuqQOL0Omd7Q@mail.gmail.com> (raw)
>> The cp command in Linux should be treated as a stub;
> The documentation says as much:
> (This is an example, not a recommendation, and might not work on all
platforms.)
> Getting it to update the sgml and produce a real diff file would be
considerably more helpful.
I've made some patches, I understand that now should go to commitfest to
push to patch.
If there is enough interest I could try to expand this warning into the
postgres wiki.
--
Este correo electrónico y, en su caso, cualquier fichero anexo al mismo,
contiene información de carácter confidencial exclusivamente dirigida a su
destinatario o destinatarios. Queda prohibida su divulgación, copia o
distribución a terceros sin la previa autorización escrita de Unitech. En
el caso de haber recibido este correo electrónico por error, se ruega
notificar inmediatamente esta circunstancia mediante reenvío a la dirección
electrónica del remitente.
The information in this e-mail and in any
attachments is confidential and solely for the attention and use of the
named addressee(s). You are hereby notified that any dissemination,
distribution or copy of this communication is prohibited without the prior
written consent of Unitech. If you have received this communication in
error, please, notify the sender by reply e-mail.
Attachments:
[text/x-patch] 0002-Add-warning-about-archive_command-reliability-and-ca.patch (1.6K, 3-0002-Add-warning-about-archive_command-reliability-and-ca.patch)
download | inline diff:
From f2009ef3eab5d0b3816d7cb98909fe06d46c9cce Mon Sep 17 00:00:00 2001
From: Dario Pudlo <[email protected]>
Date: Tue, 19 May 2026 11:11:33 -0300
Subject: [PATCH 2/2] Add warning about archive_command reliability and caveat
---
doc/src/sgml/backup.sgml | 20 ++++++++++++++++++++
1 file changed, 20 insertions(+)
diff --git a/doc/src/sgml/backup.sgml b/doc/src/sgml/backup.sgml
index 302f8c6..34bd4df 100644
--- a/doc/src/sgml/backup.sgml
+++ b/doc/src/sgml/backup.sgml
@@ -1602,6 +1602,26 @@ archive_command = 'local_backup_script.sh "%p" "%f"'
dropping tablespaces.
</para>
</listitem>
+
+ <listitem>
+ <para>
+ The archive_command example does not ensure persistence on some Unix/Linux systems,
+ a more robust (but also simple) example command is:
+
+<programlisting>
+archive_command = 'test ! -f /mnt/server/archivedir/%f && cp %p /mnt/server/archivedir/%f && sync /mnt/server/archivedir/%f'
+<programlisting>
+
+ The sync command must operate at the file level, and sync version should be
+ validated to not write the entire cache. Alternatively, in Linux, the destination file
+ system can be mounted with the sync option in the system configuration
+ (e.g., /etc/fstab), though this may impact overall performance.
+ Administrators must validate the durability and behavior of the chosen
+ archival method on their specific operating system and storage architecture,
+ as file system synchronization guarantees vary significantly across
+ platforms.
+ </para>
+ </listitem>
</itemizedlist>
</para>
--
2.54.0
[text/x-patch] 0001-Add-warning-about-archive_command-reliability.patch (1.9K, 4-0001-Add-warning-about-archive_command-reliability.patch)
download | inline diff:
From 3d260603d9ec8de67a60ba6c28629fb7d64e746e Mon Sep 17 00:00:00 2001
From: Dario Pudlo <[email protected]>
Date: Tue, 19 May 2026 11:06:12 -0300
Subject: [PATCH 1/2] Add warning about archive_command reliability
---
doc/src/sgml/backup.sgml | 13 +++++++++++--
1 file changed, 11 insertions(+), 2 deletions(-)
diff --git a/doc/src/sgml/backup.sgml b/doc/src/sgml/backup.sgml
index 168444e..302f8c6 100644
--- a/doc/src/sgml/backup.sgml
+++ b/doc/src/sgml/backup.sgml
@@ -631,14 +631,23 @@ archive_command = 'test ! -f "/mnt/server/archivedir/%f" && cp "%p" "/mn
archive_command = 'copy "%p" "C:\\server\\archivedir\\%f"' # Windows
</programlisting>
which will copy archivable WAL segments to the directory
- <filename>/mnt/server/archivedir</filename>. (This is an example, not a
- recommendation, and might not work on all platforms.) After the
+ <filename>/mnt/server/archivedir</filename>. After the
<literal>%p</literal> and <literal>%f</literal> parameters have been replaced,
the actual command executed might look like this:
<programlisting>
test ! -f /mnt/server/archivedir/00000001000000A900000065 && cp pg_wal/00000001000000A900000065 /mnt/server/archivedir/00000001000000A900000065
</programlisting>
A similar command will be generated for each new file to be archived.
+
+ IMPORTANT: The simple cp or copy commands return success as soon as the data
+ is written to the operating system cache. However, PostgreSQL does not
+ automatically force these archived files to be flushed to physical storage as
+ of datafiles. In the event of an unexpected system shutdown or power failure,
+ files confirmed as archived might be lost from the OS cache, leading to data loss
+ in Point-in-Time Recovery (PITR) or issues with pg_rewind.
+
+ To ensure data persistence, the command should include a step to synchronize
+ the file to disk.
</para>
<para>
--
2.54.0
reply
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: [email protected]
Cc: [email protected], [email protected], [email protected]
Subject: Re: Regarding the archive_command in "continuois archiving" chapter.
In-Reply-To: <CAONoTPYq+9H_1A+LLRujxVSAikaduFn-PYXDzKyuqQOL0Omd7Q@mail.gmail.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox