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

From: Melanie Plageman <melanieplageman(at)gmail(dot)com>
To: Robert Haas <robertmhaas(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, Matthias van de Meent <boekewurm+postgres(at)gmail(dot)com>, Álvaro Herrera <alvherre(at)kurilemu(dot)de>, Andres Freund <andres(at)anarazel(dot)de>
Subject: Re: WAL_LOG CREATE DATABASE strategy broken for non-standard page layouts
Date: 2026-10-12 20:06:51
Message-ID: CAAKRu_ZK6ihUvzFL8Uie2QNdGSbhAD8TemUPoURxsXk48ospgA@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Tue, Sep 22, 2026 at 7:12 PM Melanie Plageman
<melanieplageman(at)gmail(dot)com> wrote:
>
> Andres suggested off-list having CreateDatabaseUsingWalLog() thread
> information from the catalog about whether the page is a normal heap
> page down into RelationCopyStorageUsingBuffer().

Upon further off-list discussion, instead of checking the AM, we can
just check if the space between pd_upper and pd_lower is all zeroes.
If it is, there is no harm in omitting it. It should always work,
allows the optimization in more cases, and requires less code.
Attached patch does that.

I also added a test. It compares the pages of all forks of a table
between a primary and standby after doing CREATE DATABASE USING
STRATEGY WAL_LOG. I compare the whole page byte-by-byte including page
header and LSN. Are those always guaranteed to be the same on the
standby as well?

- Melanie

Attachment Content-Type Size
v1-0001-Preserve-nonstandard-pages-in-WAL-logged-database.patch text/x-patch 8.5 KB

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Alexandre Felipe 2026-10-12 20:08:43 Re: Restructured Shared Buffer Hash Table
Previous Message Dhruv Aron 2026-10-12 20:01:50 Re: Restructured Shared Buffer Hash Table