mirror of
https://github.com/postgres/postgres.git
synced 2025-07-30 11:03:19 +03:00
Exclude additional directories in pg_basebackup
The list of files and directories that pg_basebackup excludes from the backup was somewhat incomplete and unorganized. Change that with having the exclusion driven from tables. Clean up some code around it. Also document the exclusions in more detail so that users of pg_start_backup can make use of it as well. The contents of these directories are now excluded from the backup: pg_dynshmem, pg_notify, pg_serial, pg_snapshots, pg_subtrans Also fix a bug that a pg_repl_slot or pg_stat_tmp being a symlink would cause a corrupt tar header to be created. Now such symlinks are included in the backup as empty directories. Bug found by Ashutosh Sharma <ashu.coek88@gmail.com>. From: David Steele <david@pgmasters.net> Reviewed-by: Michael Paquier <michael.paquier@gmail.com>
This commit is contained in:
@ -1089,6 +1089,22 @@ SELECT pg_stop_backup();
|
||||
the new master comes on line.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
The contents of the directories <filename>pg_dynshmem/</>,
|
||||
<filename>pg_notify/</>, <filename>pg_serial/</>,
|
||||
<filename>pg_snapshots/</>, <filename>pg_stat_tmp/</>,
|
||||
and <filename>pg_subtrans/</> (but not the directories themselves) can be
|
||||
omitted from the backup as they will be initialized on postmaster startup.
|
||||
If <xref linkend="guc-stats-temp-directory"> is set and is under the data
|
||||
directory then the contents of that directory can also be omitted.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
Any file or directory beginning with <filename>pgsql_tmp</filename> can be
|
||||
omitted from the backup. These files are removed on postmaster start and
|
||||
the directories will be recreated as needed.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
The backup label
|
||||
file includes the label string you gave to <function>pg_start_backup</>,
|
||||
|
@ -2069,7 +2069,9 @@ The commands accepted in walsender mode are:
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>
|
||||
various temporary files created during the operation of the PostgreSQL server
|
||||
Various temporary files and directories created during the operation
|
||||
of the PostgreSQL server, such as any file or directory beginning
|
||||
with <filename>pgsql_tmp</>.
|
||||
</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
@ -2082,13 +2084,18 @@ The commands accepted in walsender mode are:
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>
|
||||
<filename>pg_replslot</> is copied as an empty directory.
|
||||
<filename>pg_dynshmem</>, <filename>pg_notify</>,
|
||||
<filename>pg_replslot</>, <filename>pg_serial</>,
|
||||
<filename>pg_snapshots</>, <filename>pg_stat_tmp</>, and
|
||||
<filename>pg_subtrans</> are copied as empty directories (even if
|
||||
they are symbolic links).
|
||||
</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>
|
||||
Files other than regular files and directories, such as symbolic
|
||||
links and special device files, are skipped. (Symbolic links
|
||||
links (other than for the directories listed above) and special
|
||||
device files, are skipped. (Symbolic links
|
||||
in <filename>pg_tblspc</filename> are maintained.)
|
||||
</para>
|
||||
</listitem>
|
||||
|
@ -610,10 +610,12 @@ PostgreSQL documentation
|
||||
<para>
|
||||
The backup will include all files in the data directory and tablespaces,
|
||||
including the configuration files and any additional files placed in the
|
||||
directory by third parties. But only regular files and directories are
|
||||
copied. Symbolic links (other than those used for tablespaces) and special
|
||||
device files are skipped. (See <xref linkend="protocol-replication"> for
|
||||
the precise details.)
|
||||
directory by third parties, except certain temporary files managed by
|
||||
PostgreSQL. But only regular files and directories are copied, except that
|
||||
symbolic links used for tablespaces are preserved. Symbolic links pointing
|
||||
to certain directories known to PostgreSQL are copied as empty directories.
|
||||
Other symbolic links and special device files are skipped.
|
||||
See <xref linkend="protocol-replication"> for the precise details.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
|
Reference in New Issue
Block a user