pgsql: pg_verifybackup: Enable WAL parsing for tar-format backups

Started by Andrew Dunstan3 months ago4 messagescomitters
Jump to latest
#1Andrew Dunstan
andrew@dunslane.net

pg_verifybackup: Enable WAL parsing for tar-format backups

Now that pg_waldump supports reading WAL from tar archives, remove the
restriction that forced --no-parse-wal for tar-format backups.

pg_verifybackup now automatically locates the WAL archive: it looks for
a separate pg_wal.tar first, then falls back to the main base.tar. A
new --wal-path option (replacing the old --wal-directory, which is kept
as a silent alias) accepts either a directory or a tar archive path.

The default WAL directory preparation is deferred until the backup
format is known, since tar-format backups resolve the WAL path
differently from plain-format ones.

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>
discussion: /messages/by-id/CAAJ_b94bqdWN3h2J-PzzzQ2Npbwct5ZQHggn_QoYGhC2rn-=WQ@mail.gmail.com

Branch
------
master

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

Modified Files
--------------
doc/src/sgml/ref/pg_verifybackup.sgml | 14 ++--
src/bin/pg_verifybackup/pg_verifybackup.c | 96 ++++++++++++++++++---------
src/bin/pg_verifybackup/t/002_algorithm.pl | 4 --
src/bin/pg_verifybackup/t/003_corruption.pl | 4 +-
src/bin/pg_verifybackup/t/007_wal.pl | 20 +++++-
src/bin/pg_verifybackup/t/008_untar.pl | 5 +-
src/bin/pg_verifybackup/t/010_client_untar.pl | 5 +-
7 files changed, 91 insertions(+), 57 deletions(-)

#2Peter Eisentraut
peter_e@gmx.net
In reply to: Andrew Dunstan (#1)
Re: pgsql: pg_verifybackup: Enable WAL parsing for tar-format backups

On 20.03.26 20:32, Andrew Dunstan wrote:

pg_verifybackup: Enable WAL parsing for tar-format backups

Now that pg_waldump supports reading WAL from tar archives, remove the
restriction that forced --no-parse-wal for tar-format backups.

pg_verifybackup now automatically locates the WAL archive: it looks for
a separate pg_wal.tar first, then falls back to the main base.tar. A
new --wal-path option (replacing the old --wal-directory, which is kept
as a silent alias) accepts either a directory or a tar archive path.

In the past, we have opted against silent aliases when changing a
command-line option. All options should be documented, even if they are
deprecated. Otherwise, it's confusing for users moving between major
versions or those who find that undocumented options happen to work.
See commit 35ce24c333c for an example how this was done in the past.

I suggest the option --wal-directory should be added back to the
documentation and help output.

#3Amul Sul
sulamul@gmail.com
In reply to: Peter Eisentraut (#2)
Re: pgsql: pg_verifybackup: Enable WAL parsing for tar-format backups

On Mon, May 4, 2026 at 3:00 PM Peter Eisentraut <peter@eisentraut.org> wrote:

On 20.03.26 20:32, Andrew Dunstan wrote:

pg_verifybackup: Enable WAL parsing for tar-format backups

Now that pg_waldump supports reading WAL from tar archives, remove the
restriction that forced --no-parse-wal for tar-format backups.

pg_verifybackup now automatically locates the WAL archive: it looks for
a separate pg_wal.tar first, then falls back to the main base.tar. A
new --wal-path option (replacing the old --wal-directory, which is kept
as a silent alias) accepts either a directory or a tar archive path.

In the past, we have opted against silent aliases when changing a
command-line option. All options should be documented, even if they are
deprecated. Otherwise, it's confusing for users moving between major
versions or those who find that undocumented options happen to work.
See commit 35ce24c333c for an example how this was done in the past.

I suggest the option --wal-directory should be added back to the
documentation and help output.

Agreed. Attached is a quick fix.

Regards,
Amul

Attachments:

0001-Document-deprecated-wal-directory-option-for-pg_veri.patchapplication/octet-stream; name=0001-Document-deprecated-wal-directory-option-for-pg_veri.patchDownload+2-2
#4Peter Eisentraut
peter_e@gmx.net
In reply to: Amul Sul (#3)
Re: pgsql: pg_verifybackup: Enable WAL parsing for tar-format backups

On 04.05.26 13:16, Amul Sul wrote:

On Mon, May 4, 2026 at 3:00 PM Peter Eisentraut <peter@eisentraut.org> wrote:

On 20.03.26 20:32, Andrew Dunstan wrote:

pg_verifybackup: Enable WAL parsing for tar-format backups

Now that pg_waldump supports reading WAL from tar archives, remove the
restriction that forced --no-parse-wal for tar-format backups.

pg_verifybackup now automatically locates the WAL archive: it looks for
a separate pg_wal.tar first, then falls back to the main base.tar. A
new --wal-path option (replacing the old --wal-directory, which is kept
as a silent alias) accepts either a directory or a tar archive path.

In the past, we have opted against silent aliases when changing a
command-line option. All options should be documented, even if they are
deprecated. Otherwise, it's confusing for users moving between major
versions or those who find that undocumented options happen to work.
See commit 35ce24c333c for an example how this was done in the past.

I suggest the option --wal-directory should be added back to the
documentation and help output.

Agreed. Attached is a quick fix.

Committed, thanks.