| From: | Melanie Plageman <melanieplageman(at)gmail(dot)com> |
|---|---|
| To: | Matthias van de Meent <boekewurm+postgres(at)gmail(dot)com> |
| Cc: | Michael Paquier <michael(at)paquier(dot)xyz>, Rogers Wang <rogers(dot)ww(at)qq(dot)com>, pgsql-hackers(at)lists(dot)postgresql(dot)org, Álvaro Herrera <alvherre(at)kurilemu(dot)de>, Andres Freund <andres(at)anarazel(dot)de>, Robert Haas <robertmhaas(at)gmail(dot)com> |
| Subject: | Re: WAL_LOG CREATE DATABASE strategy broken for non-standard page layouts |
| Date: | 2026-09-16 18:32:02 |
| Message-ID: | CAAKRu_ZaPGw8tN1nrSYbW-fUTyTYFWUNZ+r7bttpiWOo6P5X_Q@mail.gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
On Wed, Sep 16, 2026 at 10:26 AM Melanie Plageman
<melanieplageman(at)gmail(dot)com> wrote:
>
> I now think we have to do something. While exploring another adjacent
> topic, I realized that tuple locking has a seemingly unsolvable
> problem with this.
>
> If you have a page set all-frozen in the VM and then do CREATE
> DATABASE STRATEGY WAL_LOG, your new database will have that page set
> all-frozen in the VM on the primary and set neither all-visible nor
> all-frozen on the standby. When that standby is promoted, you now have
> a primary with the page NOT set all-frozen and a standby with the page
> set all-frozen. If you then lock the tuple on the primary, it will
> emit a WAL record with no XLH_LOCK_ALL_FROZEN_CLEARED flag because the
> primary did not need to clear all-frozen. The standby will update the
> xmax but not clear the all-frozen bit in the VM. Now you have a heap
> page with a live xmax that is set all-frozen in the VM.
>
> Basically, if you have some all-frozen data and do CREATE DATABASE
> STRATEGY WAL_LOG and then failover and then do a SELECT FOR UPDATE,
> you'll have data corruption. That seems bad.
I attached an LLM-generated reproducer.
- Melanie
| Attachment | Content-Type | Size |
|---|---|---|
| repro-noop-vm-frozen-lock-portable.sh | application/x-shellscript | 9.0 KB |
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Manuel Reyes Bravo | 2026-09-16 18:46:50 | Re: Distinguish publication exclusions in object addresses |
| Previous Message | Corey Huinker | 2026-09-16 17:58:19 | Re: Several issues with postgres_fdw stats import |