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

From: Melanie Plageman <melanieplageman(at)gmail(dot)com>
To: Zhijie Hou <houzhijie22(at)gmail(dot)com>
Cc: Robert Haas <robertmhaas(at)gmail(dot)com>, 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-11-16 17:35:22
Message-ID: CAAKRu_YAW5i_T65T38BwDhMuXT9x2Aw+PjKXqyLYXa409i-BNg@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Sat, Nov 14, 2026 at 8:08 AM Zhijie Hou <houzhijie22(at)gmail(dot)com> wrote:
>
> I just have one minor comment on the TAP test in 0001. IIUC, the
> pre-existing test in 034_create_database.pl was added by commit
> 8a8661828ae to verify that when CREATE DATABASE loads the template's
> pg_class into shared_buffers, it marks those buffers as permanent so
> that a subsequent checkpoint flushes them to disk.
>
> But with 0001, the modified test vacuuming tab_db_before_create_1 in
> template1 beforehand loads template1's pg_class into shared_buffers with
> BM_PERMANENT already set before CREATE DATABASE runs. If we want to keep
> the original regression coverage, maybe we could run the new test steps
> after the pre-existing test.

Ah, thanks so much for catching this. I read the test and not the
commit message adding it and thought it was just trying to make sure
that tables added after the copy didn't end up in the copied database
-- which, if I think about it, would have been a silly test. I've
changed it in attached v3 to retain the coverage in the initial test.

I also realized while editing this that I'll have to make a wrapper
version of CreateAndCopyRelationData() for the backports since it is
public. A bit annoying but I think better than the alternatives.

- Melanie

Attachment Content-Type Size
v3-0001-Fix-WAL-logged-CREATE-DATABASE-with-nonstandard-p.patch text/x-patch 12.7 KB
v3-0002-Reduce-WAL-generated-when-copying-relation-storag.patch text/x-patch 5.6 KB

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Melanie Plageman 2026-11-16 17:37:22 Re: WAL_LOG CREATE DATABASE strategy broken for non-standard page layouts
Previous Message Kirill Reshke 2026-11-16 17:30:22 Re: contain_nonstrict_functions_walker() fails to consider JsonExpr and CoerceToDomain