Incremental backup can use a summary past a timeline switch

From: Ayush Tiwari <ayushtiwari(dot)slg01(at)gmail(dot)com>
To: PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>, Fujii Masao <masao(dot)fujii(at)gmail(dot)com>
Subject: Incremental backup can use a summary past a timeline switch
Date: 2026-10-22 17:59:38
Message-ID: CAJTYsWV7RThdo4K62G8hC=Anpkbr54QWbOvyVvw5uvx4+-x_DQ@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

Moving the corner case I mentioned in the BUG #19774 thread [1] here,
as Fujii-san suggested.

IIUC, a standby can summarize WAL ahead of replay. So if recovery
ends at the start of one of those summaries, we could still have an
old-timeline summary for WAL we didn't replay. FilterWalSummaries()
seems to keep that file, unlike GetWalSummaries().

My worry was that a truncation in that summary could drop block
references from the new timeline when we merge it. We'd then miss
those blocks in the incremental backup and take stale ones from the
earlier backup instead.

The attached patch makes the >= / <= checks match GetWalSummaries().

I have a TAP reproducer, but it's fairly involved, so I've kept it out
of the patch for now. Happy to share it if it's useful.

[1] https://postgr.es/m/19774-8a1cbfd1774fcd0c@postgresql.org

Regards,
Ayush

Attachment Content-Type Size
v1-0001-Use-half-open-LSN-ranges-in-FilterWalSummaries.patch application/octet-stream 1.8 KB

Browse pgsql-hackers by date

  From Date Subject
Next Message surya poondla 2026-10-22 18:05:21 Re: tablecmds: Deadlock caused by Attach Partition
Previous Message shihao zhong 2026-10-22 17:52:40 Re: [PG19] CREATE SCHEMA puts an index or trigger on a same-named temp table