Re: [BUG] [PATCH] pg_basebackup produces wrong incremental files after relation truncation in segmented tables

From: Amul Sul <sulamul(at)gmail(dot)com>
To: Oleg Tkachenko <oatkachenko(at)gmail(dot)com>
Cc: pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Re: [BUG] [PATCH] pg_basebackup produces wrong incremental files after relation truncation in segmented tables
Date: 2025-12-15 14:01:05
Message-ID: CAAJ_b94y98BWWgf0KMw-E_pqM_y8+RogqHtu5nK0kA1uBE3WWw@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Mon, Dec 15, 2025 at 4:39 PM Oleg Tkachenko <oatkachenko(at)gmail(dot)com> wrote:
>
> [....]
>
> A patch correcting this logic is attached, and I’m happy to provide additional details or revisions if helpful.
>

Thanks for the reproducer; I can see the reported issue, but I am not
quite sure the proposed fix is correct and might break other cases (I
haven't tried constructed that case yet) but there is a comment
detailing that case just before the point where you are planning to do
the changes:

/*
* The truncation block length is the minimum length of the reconstructed
* file. Any block numbers below this threshold that are not present in
* the backup need to be fetched from the prior backup. At or above this
* threshold, blocks should only be included in the result if they are
* present in the backup. (This may require inserting zero blocks if the
* blocks included in the backup are non-consecutive.)
*/

IIUC, we might need the original assignment logic as it is. But we
need to ensure that truncation_block_length is not set to a value that
exceeds RELSEG_SIZE.

Regards,
Amul

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Alvaro Herrera 2025-12-15 14:25:22 Re: Adding REPACK [concurrently]
Previous Message Rahila Syed 2025-12-15 13:48:09 Re: Add WALRCV_CONNECTING state to walreceiver