Skip to content

Commit 8dfd312

Browse files
committed
pg_verifybackup: Verify tar-format backups.
This also works for compressed tar-format backups. However, -n must be used, because we use pg_waldump to verify WAL, and it doesn't yet know how to verify WAL that is stored inside of a tarfile. Amul Sul, reviewed by Sravan Kumar and by me, and revised by me.
1 parent 8410f73 commit 8dfd312

14 files changed

+1033
-154
lines changed

doc/src/sgml/ref/pg_verifybackup.sgml

Lines changed: 45 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,12 @@ PostgreSQL documentation
3434
integrity of a database cluster backup taken using
3535
<command>pg_basebackup</command> against a
3636
<literal>backup_manifest</literal> generated by the server at the time
37-
of the backup. The backup must be stored in the "plain"
38-
format; a "tar" format backup can be checked after extracting it.
37+
of the backup. The backup may be stored either in the "plain" or the "tar"
38+
format; this includes tar-format backups compressed with any algorithm
39+
supported by <application>pg_basebackup</application>. However, at present,
40+
<literal>WAL</literal> verification is supported only for plain-format
41+
backups. Therefore, if the backup is stored in tar-format, the
42+
<literal>-n, --no-parse-wal</literal> option should be used.
3943
</para>
4044

4145
<para>
@@ -168,6 +172,45 @@ PostgreSQL documentation
168172
</listitem>
169173
</varlistentry>
170174

175+
<varlistentry>
176+
<term><option>-F <replaceable class="parameter">format</replaceable></option></term>
177+
<term><option>--format=<replaceable class="parameter">format</replaceable></option></term>
178+
<listitem>
179+
<para>
180+
Specifies the format of the backup. <replaceable>format</replaceable>
181+
can be one of the following:
182+
183+
<variablelist>
184+
<varlistentry>
185+
<term><literal>p</literal></term>
186+
<term><literal>plain</literal></term>
187+
<listitem>
188+
<para>
189+
Backup consists of plain files with the same layout as the
190+
source server's data directory and tablespaces.
191+
</para>
192+
</listitem>
193+
</varlistentry>
194+
195+
<varlistentry>
196+
<term><literal>t</literal></term>
197+
<term><literal>tar</literal></term>
198+
<listitem>
199+
<para>
200+
Backup consists of tar files, which may be compressed. A valid
201+
backup includes the main data directory in a file named
202+
<filename>base.tar</filename>, the WAL files in
203+
<filename>pg_wal.tar</filename>, and separate tar files for
204+
each tablespace, named after the tablespace's OID. If the backup
205+
is compressed, the relevant compression extension is added to the
206+
end of each file name.
207+
</para>
208+
</listitem>
209+
</varlistentry>
210+
</variablelist></para>
211+
</listitem>
212+
</varlistentry>
213+
171214
<varlistentry>
172215
<term><option>-n</option></term>
173216
<term><option>--no-parse-wal</option></term>

src/bin/pg_verifybackup/Makefile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,12 @@ top_builddir = ../../..
1717
include $(top_builddir)/src/Makefile.global
1818

1919
# We need libpq only because fe_utils does.
20+
override CPPFLAGS := -I$(libpq_srcdir) $(CPPFLAGS)
2021
LDFLAGS_INTERNAL += -L$(top_builddir)/src/fe_utils -lpgfeutils $(libpq_pgport)
2122

2223
OBJS = \
2324
$(WIN32RES) \
25+
astreamer_verify.o \
2426
pg_verifybackup.o
2527

2628
all: pg_verifybackup

0 commit comments

Comments
 (0)