Re: pg_waldump: support decoding of WAL inside tarfile

Chao Li <li.evan.chao@gmail.com>

From: Chao Li <li.evan.chao@gmail.com>
To: Amul Sul <sulamul@gmail.com>
Cc: Jakub Wartak <jakub.wartak@enterprisedb.com>, Robert Haas <robertmhaas@gmail.com>, PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>
Date: 2025-11-26T07:23:39Z
Lists: pgsql-hackers

Commits

Same data as JSON: GET /api/v1/messages/:b64id/commits the thread's linked commits as JSON, with link sources. API reference →
  1. Move tar detection and compression logic to common.

  2. pg_verifybackup: Enable WAL parsing for tar-format backups

  3. pg_waldump: Add support for reading WAL from tar archives

  4. pg_waldump: Preparatory refactoring for tar archive WAL decoding.

  5. pg_verifybackup: Verify tar-format backups.


> On Nov 26, 2025, at 14:02, Amul Sul <sulamul@gmail.com> wrote:
> 
>> 9 - 0004
>> ```
>> +/*
>> + * Create an astreamer that can read WAL from tar file.
>> + */
>> +static astreamer *
>> +astreamer_waldump_new(XLogDumpPrivate *privateInfo)
>> +{
>> +       astreamer_waldump *streamer;
>> +
>> +       streamer = palloc0(sizeof(astreamer_waldump));
>> +       *((const astreamer_ops **) &streamer->base.bbs_ops) =
>> +               &astreamer_waldump_ops;
>> +
>> +       streamer->privateInfo = privateInfo;
>> +
>> +       return &streamer->base;
>> +}
>> ```
>> 
>> This function allocates memory for streamer but only returns &streamer->base, so memory of streamer is leaked.
>> 
> 
> May I know why you think there would be a memory leak? I believe the
> address of the structure is the same as the address of its first
> member, base. I am returning base because the goal is to return a
> generic astreamer type, which is the standard approach used in other
> archive streamer code.

Ah… Got it.

Best regards,
--
Chao Li (Evan)
HighGo Software Co., Ltd.
https://www.highgo.com/