| From: | Fujii Masao <fujii(at)postgresql(dot)org> |
|---|---|
| To: | pgsql-committers(at)lists(dot)postgresql(dot)org |
| Subject: | pgsql: Fix incremental backup data loss due to WAL summary merge order |
| Date: | 2026-11-01 15:27:22 |
| Message-ID: | E1xNXSs-00000001fhK-3w59@gemulon.postgresql.org |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-committers |
Fix incremental backup data loss due to WAL summary merge order
An incremental backup taken after a relation is truncated and extended
again can omit modified blocks. Combining it with an earlier backup can
then restore stale data, causing live rows to disappear and deleted rows
to reappear.
WAL summaries were merged without ensuring LSN order. Applying a limit
block from an older summary after processing a newer summary could
discard references to blocks modified later, causing those blocks to
be omitted from the backup.
Sort the required summaries by ascending start LSN before merging them,
preserving references to later block modifications so that the required
blocks are included in the backup.
Backpatch to 17, where incremental backup was introduced.
Bug: #19774
Reported-by: Ke <kehan5800(at)gmail(dot)com>
Author: Ke <kehan5800(at)gmail(dot)com>
Co-authored-by: Fujii Masao <masao(dot)fujii(at)gmail(dot)com>
Reviewed-by: Ayush Tiwari <ayushtiwari(dot)slg01(at)gmail(dot)com>
Discussion: https://www.postgresql.org/message-id/19774-8a1cbfd1774fcd0c%40postgresql.org
Backpatch-through: 17
Branch
------
REL_17_STABLE
Details
-------
https://git.postgresql.org/pg/commitdiff/9580e29da90c5f49cf34613d772ebbd5614882b1
Modified Files
--------------
src/backend/backup/basebackup_incremental.c | 19 +++++
src/bin/pg_combinebackup/meson.build | 1 +
src/bin/pg_combinebackup/t/013_summary_order.pl | 94 +++++++++++++++++++++++++
3 files changed, 114 insertions(+)
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Andrew Dunstan | 2026-11-01 15:50:02 | pgsql: Reject enforcing a parent CHECK constraint over a NOT VALID chil |
| Previous Message | Fujii Masao | 2026-11-01 15:27:11 | pgsql: Fix incremental backup data loss due to WAL summary merge order |