pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
pgsql: Fix incremental backup data loss due to WAL summary merge order
4+ messages / 1 participants
[nested] [flat]

* pgsql: Fix incremental backup data loss due to WAL summary merge order
@ 2026-11-01 15:26 Fujii Masao <fujii@postgresql.org>
  0 siblings, 0 replies; 4+ messages in thread

From: Fujii Masao @ 2026-11-01 15:26 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

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@gmail.com>
Author: Ke <kehan5800@gmail.com>
Co-authored-by: Fujii Masao <masao.fujii@gmail.com>
Reviewed-by: Ayush Tiwari <ayushtiwari.slg01@gmail.com>
Discussion: https://www.postgresql.org/message-id/19774-8a1cbfd1774fcd0c%40postgresql.org
Backpatch-through: 17

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/d903620acf65e45a560af72aadd0965c45104ceb

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(+)



^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* pgsql: Fix incremental backup data loss due to WAL summary merge order
@ 2026-11-01 15:26 Fujii Masao <fujii@postgresql.org>
  0 siblings, 0 replies; 4+ messages in thread

From: Fujii Masao @ 2026-11-01 15:26 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

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@gmail.com>
Author: Ke <kehan5800@gmail.com>
Co-authored-by: Fujii Masao <masao.fujii@gmail.com>
Reviewed-by: Ayush Tiwari <ayushtiwari.slg01@gmail.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(+)



^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* pgsql: Fix incremental backup data loss due to WAL summary merge order
@ 2026-11-01 15:27 Fujii Masao <fujii@postgresql.org>
  0 siblings, 0 replies; 4+ messages in thread

From: Fujii Masao @ 2026-11-01 15:27 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

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@gmail.com>
Author: Ke <kehan5800@gmail.com>
Co-authored-by: Fujii Masao <masao.fujii@gmail.com>
Reviewed-by: Ayush Tiwari <ayushtiwari.slg01@gmail.com>
Discussion: https://www.postgresql.org/message-id/19774-8a1cbfd1774fcd0c%40postgresql.org
Backpatch-through: 17

Branch
------
REL_18_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/9e20db542b0ff5fdcb839e9b440db337c7f439a5

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(+)



^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* pgsql: Fix incremental backup data loss due to WAL summary merge order
@ 2026-11-01 15:27 Fujii Masao <fujii@postgresql.org>
  0 siblings, 0 replies; 4+ messages in thread

From: Fujii Masao @ 2026-11-01 15:27 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

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@gmail.com>
Author: Ke <kehan5800@gmail.com>
Co-authored-by: Fujii Masao <masao.fujii@gmail.com>
Reviewed-by: Ayush Tiwari <ayushtiwari.slg01@gmail.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(+)



^ permalink  raw  reply  [nested|flat] 4+ messages in thread


end of thread, other threads:[~2026-11-01 15:27 UTC | newest]

Thread overview: 4+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2026-11-01 15:26 pgsql: Fix incremental backup data loss due to WAL summary merge order Fujii Masao <fujii@postgresql.org>
2026-11-01 15:26 pgsql: Fix incremental backup data loss due to WAL summary merge order Fujii Masao <fujii@postgresql.org>
2026-11-01 15:27 pgsql: Fix incremental backup data loss due to WAL summary merge order Fujii Masao <fujii@postgresql.org>
2026-11-01 15:27 pgsql: Fix incremental backup data loss due to WAL summary merge order Fujii Masao <fujii@postgresql.org>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox