Skip to content

Commit 3cabe45

Browse files
committed
doc: Add note about re-archiving of same WAL files in docs.
The server may attempt to re-archive a WAL file that was previously archived. This commit adds the note about how an archive library should handle such a re-archiving. Author: Nathan Bossart Reviewed-by: David Steele, Kyotaro Horiguchi Discussion: https://postgr.es/m/CA+TgmoaeTe4oUT39A4nt=8LD6UJ5u0vcmGc5+Aksn-4oKRb8-w@mail.gmail.com
1 parent 756e221 commit 3cabe45

File tree

1 file changed

+20
-5
lines changed

1 file changed

+20
-5
lines changed

doc/src/sgml/backup.sgml

+20-5
Original file line numberDiff line numberDiff line change
@@ -681,14 +681,29 @@ test ! -f /mnt/server/archivedir/00000001000000A900000065 && cp pg_wal/0
681681
any pre-existing archive file. This is an important safety feature to
682682
preserve the integrity of your archive in case of administrator error
683683
(such as sending the output of two different servers to the same archive
684-
directory).
684+
directory). It is advisable to test your proposed archive library to ensure
685+
that it does not overwrite an existing file.
685686
</para>
686687

687688
<para>
688-
It is advisable to test your proposed archive library to ensure that it
689-
indeed does not overwrite an existing file, <emphasis>and that it returns
690-
<literal>false</literal> in this case</emphasis>.
691-
The example command above for Unix ensures this by including a separate
689+
In rare cases, <productname>PostgreSQL</productname> may attempt to
690+
re-archive a WAL file that was previously archived. For example, if the
691+
system crashes before the server makes a durable record of archival success,
692+
the server will attempt to archive the file again after restarting (provided
693+
archiving is still enabled). When an archive library encounters a
694+
pre-existing file, it may return <literal>true</literal> if the WAL file has
695+
identical contents to the pre-existing archive and the pre-existing archive
696+
is fully persisted to storage. Alternatively, the archive library may
697+
return <literal>false</literal> anytime a pre-existing file is encountered,
698+
but this will require manual action by an administrator to resolve. If a
699+
pre-existing file contains different contents than the WAL file being
700+
archived, the archive library <emphasis>must</emphasis> return
701+
<literal>false</literal>.
702+
</para>
703+
704+
<para>
705+
The example command above for Unix avoids overwriting a pre-existing archive
706+
by including a separate
692707
<command>test</command> step. On some Unix platforms, <command>cp</command> has
693708
switches such as <option>-i</option> that can be used to do the same thing
694709
less verbosely, but you should not rely on these without verifying that

0 commit comments

Comments
 (0)