Re: pg_waldump: WAL in pg_wal.old/ inside a tar archive is read as WAL

From: Raja Sai pranav <rajasaipranav0(at)gmail(dot)com>
To: michael(at)paquier(dot)xyz
Cc: pgsql-hackers(at)lists(dot)postgresql(dot)org, sulamul(at)gmail(dot)com, robertmhaas(at)gmail(dot)com
Subject: Re: pg_waldump: WAL in pg_wal.old/ inside a tar archive is read as WAL
Date: 2026-11-21 06:00:42
Message-ID: nh-36126b86-8764-4467-9c7d-ed348fe10122@google.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Sat, Nov 21, 2026 at 07:50:26AM +0900, Michael Paquier wrote:
> You are not mentioning which tool you are using is creating this
> folder layer and particularly the reason behind this choice.

No tool creates it. I made pg_wal.old/ by hand to test the check, and I
don't know of any tool or report where this happens in practice. I should
have said that in the first mail.

What I found is that member_is_wal_file() doesn't do what its comment says
("Skip files in subdirectories other than pg_wal/"). It compares only the
first six characters, so any member whose path starts with "pg_wal" is
taken as WAL. pg_basebackup copies whatever extra directories a user leaves
in the data directory, so such a directory ends up in base.tar. When that
happens, pg_verifybackup can report a backup as verified while its real WAL
is damaged.

If you think the case is too unlikely to need a test, I'm fine with keeping
only the code change, so that the check matches the comment, and dropping
the test.

Regards,
Sai Pranav

On Sat, Nov 21, 2026 04:20 AM, Michael Paquier <michael(at)paquier(dot)xyz> wrote:

> On Fri, Nov 20, 2026 at 07:22:11AM -0800, Raja Sai pranav wrote:
> > So pg_wal.old/000000010000000000000038 or
> > pg_wal/somedir/000000010000000000000038 is also taken as WAL. If such a
> > file comes first in the archive, the real pg_wal/ copy is then skipped
> as a
> > duplicate.
>
> You are not mentioning which tool you are using is creating this
> folder layer and particularly the reason behind this choice. In-core
> configuration relies on max_wal_size as one way to control the size of
> pg_wal/. So you are breaking at least one rule here.
> --
> Michael
>

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Ishjaap Singh 2026-11-21 08:58:40 Re: Fix jsonpath printing of operations followed by an accessor
Previous Message Sho Ito 2026-11-21 04:38:35 Re: [PATCH v1] Preserve implicit composite casts in ROW deparsing