| 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:26:58 |
| Message-ID: | E1xNXSU-00000001ff5-1GgF@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_19_STABLE
Details
-------
https://git.postgresql.org/pg/commitdiff/2bae29d7e44c0aaa3bb2847941c3ed43647b16f0
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 | Fujii Masao | 2026-11-01 15:27:11 | pgsql: Fix incremental backup data loss due to WAL summary merge order |
| Previous Message | Fujii Masao | 2026-11-01 15:26:27 | pgsql: Fix WAL summary boundary checks for incremental backups. |