]> git.ipfire.org Git - thirdparty/postgresql.git/commit
pg_waldump: Add support for reading WAL from tar archives
authorAndrew Dunstan <andrew@dunslane.net>
Fri, 20 Mar 2026 19:31:35 +0000 (15:31 -0400)
committerAndrew Dunstan <andrew@dunslane.net>
Fri, 20 Mar 2026 19:31:35 +0000 (15:31 -0400)
commitb15c1513984e6eafd264bf6e84a08549905621f1
tree5b71ffd69c5c080d614e67f4967bff3faf21fa21
parentf8a0cd26717063b99d846b693b416187ab56d67b
pg_waldump: Add support for reading WAL from tar archives

pg_waldump can now accept the path to a tar archive (optionally
compressed with gzip, lz4, or zstd) containing WAL files and decode
them.  This was added primarily for pg_verifybackup, which previously
had to skip WAL parsing for tar-format backups.

The implementation uses the existing archive streamer infrastructure
with a hash table to track WAL segments read from the archive.  If WAL
files within the archive are not in sequential order, out-of-order
segments are written to a temporary directory (created via mkdtemp under
$TMPDIR or the archive's directory) and read back when needed.  An
atexit callback ensures the temporary directory is cleaned up.

The --follow option is not supported when reading from a tar archive.

Author: Amul Sul <sulamul@gmail.com>
Reviewed-by: Robert Haas <robertmhaas@gmail.com>
Reviewed-by: Jakub Wartak <jakub.wartak@enterprisedb.com>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Euler Taveira <euler@eulerto.com>
Reviewed-by: Andrew Dunstan <andrew@dunslane.net>
Reviewed-by: Zsolt Parragi <zsolt.parragi@percona.com>
discussion: https://postgr.es/m/CAAJ_b94bqdWN3h2J-PzzzQ2Npbwct5ZQHggn_QoYGhC2rn-=WQ@mail.gmail.com
doc/src/sgml/ref/pg_waldump.sgml
src/bin/pg_waldump/Makefile
src/bin/pg_waldump/archive_waldump.c [new file with mode: 0644]
src/bin/pg_waldump/meson.build
src/bin/pg_waldump/pg_waldump.c
src/bin/pg_waldump/pg_waldump.h
src/bin/pg_waldump/t/001_basic.pl
src/tools/pgindent/typedefs.list