Re: WAL_LOG CREATE DATABASE strategy broken for non-standard page layouts

From: Michael Paquier <michael(at)paquier(dot)xyz>
To: Rogers Wang <rogers(dot)ww(at)qq(dot)com>
Cc: pgsql-hackers(at)lists(dot)postgresql(dot)org, Matthias van de Meent <boekewurm+postgres(at)gmail(dot)com>, Álvaro Herrera <alvherre(at)kurilemu(dot)de>, melanieplageman(at)gmail(dot)com
Subject: Re: WAL_LOG CREATE DATABASE strategy broken for non-standard page layouts
Date: 2026-08-31 05:37:46
Message-ID: apUTKUUvYfG3SlBF@paquier.xyz
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Mon, Aug 24, 2026 at 01:04:44AM +0800, Rogers Wang wrote:
> What changed since the last discussion
> --------------------------------------
> The divergence was assessed back then as "not actively harmful". That
> no longer holds in v19: commit add323da40a added
> Assert(BufferIsDirty(vmbuffer)) to heap_xlog_prune_freeze(), which
> makes the divergence fatal on assert builds after a switchover:
>
> 1. The promoted standby has a zeroed VM, so VACUUM FREEZE sets the
>    bits again, emitting PRUNE records with no FPI for the VM buffer.
> 2. The old primary, rejoined as standby, still has the bits set with
>    an older page LSN, so replay takes the redo branch - but
>    visibilitymap_set() is a no-op there (bits already set) and the
>    buffer stays clean.
> 3. Assert(BufferIsDirty(vmbuffer)) fires, and the node crash-loops on
>    that record.
>
> And even without assertions, the new database on the standby silently
> loses all all-visible/all-frozen bits and all free space data of every
> copied relation.

Hmm. This warrants an open item for v19, at least to be discussed.
Adding Melanie in CC as the committer of add323da40a.
--
Michael

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Michael Paquier 2026-08-31 06:15:33 Re: Internal error codes triggered by regression tests and user queries, take 2
Previous Message Michael Paquier 2026-08-31 05:33:40 Re: Add starelid, attnum to pg_stats and leverage this in pg_dump