Re: Re: BUG #19776: pg_combinebackup ignores the truncation_block_length of an intermediate incremental backup

From: Raja Sai pranav <rajasaipranav0(at)gmail(dot)com>
To: rajeshkumarth(at)google(dot)com
Cc: pgsql-hackers(at)lists(dot)postgresql(dot)org, kehan5800(at)gmail(dot)com, pgsql-bugs(at)lists(dot)postgresql(dot)org, masao(dot)fujii(at)gmail(dot)com, robertmhaas(at)gmail(dot)com, dilipkumarb(at)google(dot)com
Subject: Re: Re: BUG #19776: pg_combinebackup ignores the truncation_block_length of an intermediate incremental backup
Date: 2026-11-07 15:21:21
Message-ID: CAPHduZBeHXjj3UsXq=MS5NZ1KHW+ERcabwb2J7NccTb2j3MWFA@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-bugs pgsql-hackers

Hi Rajesh,

Thanks - v3 addresses both points from the v2 review.

- v3 applies cleanly to current master (72b9498df9a), including past
fcfd2456078 ("Reject out-of-range block numbers in incremental files"),
which also touches reconstruct.c.
- The reconstruct.c change is the same logic I tested on v2 (track the
running
truncation_block_length upper bound, tighten it on each intermediate backup
with a smaller s->truncation_block_length, applied after the file's own
blocks and only to incremental files, and clear full_copy_possible there).
In my v2 testing that fixed the 011 test (which failed 3/3 on master without
it).
- v3 now adds the bulk-extension regression test I'd flagged as missing: the
node3 / incr2-incr4 chain that bumps shared_buffers so COPY bulk-extends the
relation past an intermediate truncation point, leaving zero-filled
unwritten
pages in the truncated range. That exercises exactly the full_copy_possible
=
false / "unwritten blocks sourced from a pre-truncation backup" path, which
is what the fix guards.
- The reworded comment reads clearly now.

LGTM.

(Note on testing: I re-confirmed v3 applies to current master and re-read
the
diff; the reconstruct.c fix is unchanged from the v2 I built and tested. I
did
not re-run the TAP suite on v3 this round - my macOS TAP environment aborts
in
pg_regress --config-auth independent of the patch - so the pass/fail
evidence
is inherited from the identical v2 fix plus a read of the new test.)

Regards,
Sai Pranav

On Wed, Nov 04, 2026 08:21 PM, Rajesh Kumar Thandapani <
rajeshkumarth(at)google(dot)com> wrote:

> Hi Sai Pranav,
>
> > - Nothing tests the full_copy_possible = false in the new block: with
> that
> > line removed, the whole suite still passes. I think the line is needed,
> > though: without it, a chain where no block comes from an incremental file
> > and the full file happens to be as long as the latest
> > truncation_block_length would be copied whole, including the blocks the
> > intermediate backup had truncated away. I couldn't build that case
> through
> > the server (regrowing the relation writes blocks that end up in the later
> > incremental file), so a test may not be practical. A short comment saying
> > why the line is there would help.
> >
> > - Small wording nit in the new comment: blocks at or beyond an
> incremental
> > file's truncation_block_length are not necessarily blocks that "did not
> > exist at the time of this backup"; they may have been truncated away at
> > some point during that backup's WAL range. Something like "Blocks at or
> > beyond this file's truncation_block_length were truncated away at some
> > point before this backup, so their contents in any earlier backup are
> > stale" might be clearer.
>
> Thanks for reviewing and testing the patch! Both points make sense.
> I updated the comment in v3 to clarify the truncation wording and
> explain why we also clear full_copy_possible there.
>
> Regards,
> Rajesh
>

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message PG Bug reporting form 2026-11-07 15:36:50 BUG #19849: queries fail after ANALYZE with expression stats on arrays
Previous Message Atisss hh 2026-11-07 15:16:33 Re: BUG #19848: BEGIN ATOMIC with unnamed/OUT params breaks restore and pg_upgrade

Browse pgsql-hackers by date

  From Date Subject
Next Message Xuneng Zhou 2026-11-07 15:22:35 Re: BGWORKER_INTERRUPTIBLE workers are never restarted after DROP/ALTER/CREATE DATABASE
Previous Message Jeevan Chalke 2026-11-07 14:35:02 Re: PL/pgSQL: allow parallel query for assignment statements