pgsql: pg_waldump: Add support for reading WAL from tar archives

From: Andrew Dunstan <andrew(at)dunslane(dot)net>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: pg_waldump: Add support for reading WAL from tar archives
Date: 2026-03-20 19:32:10
Message-ID: E1w3fZp-000gjc-2w@gemulon.postgresql.org
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-committers

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(at)gmail(dot)com>
Reviewed-by: Robert Haas <robertmhaas(at)gmail(dot)com>
Reviewed-by: Jakub Wartak <jakub(dot)wartak(at)enterprisedb(dot)com>
Reviewed-by: Chao Li <li(dot)evan(dot)chao(at)gmail(dot)com>
Reviewed-by: Euler Taveira <euler(at)eulerto(dot)com>
Reviewed-by: Andrew Dunstan <andrew(at)dunslane(dot)net>
Reviewed-by: Zsolt Parragi <zsolt(dot)parragi(at)percona(dot)com>
discussion: https://postgr.es/m/CAAJ_b94bqdWN3h2J-PzzzQ2Npbwct5ZQHggn_QoYGhC2rn-=WQ@mail.gmail.com

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/b15c1513984e6eafd264bf6e84a08549905621f1

Modified Files
--------------
doc/src/sgml/ref/pg_waldump.sgml | 23 +-
src/bin/pg_waldump/Makefile | 7 +-
src/bin/pg_waldump/archive_waldump.c | 860 +++++++++++++++++++++++++++++++++++
src/bin/pg_waldump/meson.build | 4 +-
src/bin/pg_waldump/pg_waldump.c | 288 +++++++++---
src/bin/pg_waldump/pg_waldump.h | 51 +++
src/bin/pg_waldump/t/001_basic.pl | 264 ++++++++---
src/tools/pgindent/typedefs.list | 4 +
8 files changed, 1364 insertions(+), 137 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Jeff Davis 2026-03-20 19:44:54 pgsql: Fix dependency on FDW's connection function.
Previous Message Nathan Bossart 2026-03-20 19:16:30 pgsql: Bump transaction/multixact ID warning limits to 100M.