0001-Add-warning-about-archive_command-reliability.patch
text/x-patch
Filename: 0001-Add-warning-about-archive_command-reliability.patch
Type: text/x-patch
Part: 1
Patch
Format: format-patch
Series: patch 0001
Subject: Add warning about archive_command reliability
| File | + | − |
|---|---|---|
| doc/src/sgml/backup.sgml | 11 | 2 |
From 3d260603d9ec8de67a60ba6c28629fb7d64e746e Mon Sep 17 00:00:00 2001
From: Dario Pudlo <dario_d_s@unitech.com.ar>
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