pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Zhijie Hou <houzhijie22@gmail.com>
To: Melanie Plageman <melanieplageman@gmail.com>
Cc: Robert Haas <robertmhaas@gmail.com>
Cc: Michael Paquier <michael@paquier.xyz>
Cc: Rogers Wang <rogers.ww@qq.com>
Cc: pgsql-hackers@lists.postgresql.org, Matthias van de Meent <boekewurm+postgres@gmail.com>
Cc: Álvaro Herrera <alvherre@kurilemu.de>
Cc: Andres Freund <andres@anarazel.de>
Subject: Re: WAL_LOG CREATE DATABASE strategy broken for non-standard page layouts
Date: Wed, 18 Nov 2026 23:41:52 +0800
Message-ID: <d977e2cc-6d18-49be-8e5b-de71360d82f8@gmail.com> (raw)
In-Reply-To: <CAAKRu_YshjAdgXWd2_bQ-CEH8erG6dMSrsJa2gag-ueAYEij6A@mail.gmail.com>
References: <202602021525.qv4m7oge4eca@alvherre.pgsql>
	<tencent_2E870046716FD94285045E96505A2D4E2908@qq.com>
	<apUTKUUvYfG3SlBF@paquier.xyz>
	<CAAKRu_YE-T_qObGxn5gC-b27umwCMGKP40eaOKhVAbTJ9rJhXQ@mail.gmail.com>
	<CA+TgmobaT5h77ZUheD7uoDcK+vRj63Eaa9q8muo8RtqdfctLog@mail.gmail.com>
	<CAAKRu_ZxxVLPfpZiX4L+QURW6HO60v8mFSRn64zado4kzygt5w@mail.gmail.com>
	<CAAKRu_ZK6ihUvzFL8Uie2QNdGSbhAD8TemUPoURxsXk48ospgA@mail.gmail.com>
	<CA+TgmobaoRn6AEEv19Ri1BbMyUS0aOMNdcAOzShDn2JW8sq21w@mail.gmail.com>
	<CAAKRu_b9r-Pz9gzYvC+5EHnXqNgfsJhcH=huUGbXzvcnbHtxCg@mail.gmail.com>
	<6e62d593-a8b2-415d-834d-e54ed519bb04@gmail.com>
	<CAAKRu_YAW5i_T65T38BwDhMuXT9x2Aw+PjKXqyLYXa409i-BNg@mail.gmail.com>
	<2889116c-7da1-4ab0-b10a-3fadb99c24e7@gmail.com>
	<CAAKRu_YshjAdgXWd2_bQ-CEH8erG6dMSrsJa2gag-ueAYEij6A@mail.gmail.com>

Hi,

On Wed, Nov18, 2026 at 06:47 AM Melanie Plageman wrote:
> On Tue, Nov 17, 2026 at 10:21 AM Zhijie Hou <houzhijie22@gmail.com> wrote:
> >
> > I think we also need to increase shared_buffers (e.g., to 16MB),
> > because $node->init(allows_streaming => 1) sets shared_buffers to
> > 1MB internally, causing the pg_class pages to be evicted from
> > shared_buffers before CREATE TABLE runs, so the test could not reach
> > the old bug path.
>
> Ah, okay. I'll do that. The original test feels awfully fragile. Is
> there something we could do to strengthen it? Like check that one of
> the buffers is marked BM_PERMANENT somehow? It seems very trivial to
> accidentally eliminate the coverage. And there are of course lots of
> ways for those buffers to get evicted.
Maybe we could add a few comments above the CREATE DATABASE command to 
give developers a hint, and if it's worth it, we could add a check after 
the command to verify that pg_class's pages stay in the buffer cache 
(But note that if we add this check, we'd better disable autovaccum to 
prevent background access):

# Verify that scanning template1's pg_class performs zero disk reads,
# confirming its pages were not evicted by CREATE DATABASE.
is( $node->safe_psql(
		$db_template, q{
	SELECT pg_stat_get_xact_blocks_fetched('pg_class'::regclass) -
	       pg_stat_get_xact_blocks_hit('pg_class'::regclass)
	FROM pg_class
	HAVING sum(relpages) >= 0;
}),
	"0",
	"template pg_class pages remain cached after CREATE DATABASE");

-- 
Best Regards,
Zhijie Hou






view thread (35+ messages)  latest in thread

Message-ID: <d977e2cc-6d18-49be-8e5b-de71360d82f8@gmail.com>
Permalink:  ../d977e2cc-6d18-49be-8e5b-de71360d82f8@gmail.com/
Also on:    postgresql.org/message-id/d977e2cc-6d18-49be-8e5b-de71360d82f8@gmail.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-hackers@postgresql.org
  Cc: houzhijie22@gmail.com, melanieplageman@gmail.com, robertmhaas@gmail.com, michael@paquier.xyz, rogers.ww@qq.com, boekewurm+postgres@gmail.com, alvherre@kurilemu.de, andres@anarazel.de
  Subject: Re: WAL_LOG CREATE DATABASE strategy broken for non-standard page layouts
  In-Reply-To: <d977e2cc-6d18-49be-8e5b-de71360d82f8@gmail.com>
  References: <202602021525.qv4m7oge4eca@alvherre.pgsql> <tencent_2E870046716FD94285045E96505A2D4E2908@qq.com> <apUTKUUvYfG3SlBF@paquier.xyz> <CAAKRu_YE-T_qObGxn5gC-b27umwCMGKP40eaOKhVAbTJ9rJhXQ@mail.gmail.com> <CA+TgmobaT5h77ZUheD7uoDcK+vRj63Eaa9q8muo8RtqdfctLog@mail.gmail.com> <CAAKRu_ZxxVLPfpZiX4L+QURW6HO60v8mFSRn64zado4kzygt5w@mail.gmail.com> <CAAKRu_ZK6ihUvzFL8Uie2QNdGSbhAD8TemUPoURxsXk48ospgA@mail.gmail.com> <CA+TgmobaoRn6AEEv19Ri1BbMyUS0aOMNdcAOzShDn2JW8sq21w@mail.gmail.com> <CAAKRu_b9r-Pz9gzYvC+5EHnXqNgfsJhcH=huUGbXzvcnbHtxCg@mail.gmail.com> <6e62d593-a8b2-415d-834d-e54ed519bb04@gmail.com> <CAAKRu_YAW5i_T65T38BwDhMuXT9x2Aw+PjKXqyLYXa409i-BNg@mail.gmail.com> <2889116c-7da1-4ab0-b10a-3fadb99c24e7@gmail.com> <CAAKRu_YshjAdgXWd2_bQ-CEH8erG6dMSrsJa2gag-ueAYEij6A@mail.gmail.com> <d977e2cc-6d18-49be-8e5b-de71360d82f8@gmail.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox