| From: | Rajesh Kumar Thandapani <rajeshkumarth(at)google(dot)com> |
|---|---|
| To: | Ke <kehan5800(at)gmail(dot)com>, pgsql-bugs(at)lists(dot)postgresql(dot)org |
| Cc: | pgsql-hackers(at)lists(dot)postgresql(dot)org, Robert Haas <robertmhaas(at)gmail(dot)com>, Dilip Kumar <dilipkumarb(at)google(dot)com> |
| Subject: | Re: BUG #19776: pg_combinebackup ignores the truncation_block_length of an intermediate incremental backup |
| Date: | 2026-10-28 13:16:43 |
| Message-ID: | CAJoZ81s07r3akkKp-nJ8sgQNoCM0nu24g3HZ0FxTSY1OqsgurQ@mail.gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-bugs pgsql-hackers |
Hi Ke,
> This problem occurs because in reconstruct_from_incremental_file(),
> pg_combinebackup determines which blocks require reconstruction based only on
> latest_source->truncation_block_length, without considering the
> truncation_block_length of intermediate backups.
Thanks for the report and reproducer.
While walking backward through the backup chain in
reconstruct_from_incremental_file(), we only check
b < latest_source->truncation_block_length when deciding whether an
unassigned block in sourcemap[] can be taken from an earlier backup. If an
intermediate backup truncated the relation and a later backup extended it
again without writing every block in that range (e.g., unwritten pages at
the end of a relation after bulk extension in COPY), those blocks remain
NULL in sourcemap[] and end up being copied from a backup prior to the
truncation.
Attached is a patch that tracks the current truncation_block_length upper
bound as we step backward through the chain and clamps it whenever an
incremental backup has a smaller s->truncation_block_length. Any remaining
unassigned blocks at or above that limit stay NULL in sourcemap[] and are
written as zeroes.
I also extended 011_ib_truncation.pl to cover an intermediate truncation
followed by COPY bulk extension.
Regards,
Rajesh Kumar Thandapani
| Attachment | Content-Type | Size |
|---|---|---|
| v1-0001-Fix-pg_combinebackup-with-truncated-intermediate-.patch | application/x-patch | 5.9 KB |
| From | Date | Subject | |
|---|---|---|---|
| Next Message | shihao zhong | 2026-10-28 13:58:53 | Re: BUG #19792: BUG: Deadlock between WaitIO and read-stream look-ahead under io_method=io_uring (18.6) |
| Previous Message | PG Bug reporting form | 2026-10-28 13:06:17 | BUG #19803: Assertion "!parallel_aware || pathnode->path.parallel_safe" in create_append_path |
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Greg Burd | 2026-10-28 13:29:39 | Re: WAL record CRC calculated incorrectly because of underlying buffer modification |
| Previous Message | Bertrand Drouvot | 2026-10-28 13:03:09 | Re: [PATCH] pgstat: Add helper to drop entries from a stats kind's hash |