pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Nathan Bossart <nathandbossart@gmail.com>
To: Robert Haas <robertmhaas@gmail.com>
Cc: Fujii Masao <masao.fujii@oss.nttdata.com>
Cc: pgsql-hackers@lists.postgresql.org
Subject: Re: Add a GUC check hook to ensure summarize_wal cannot be enabled when wal_level is minimal
Date: Mon, 15 Jul 2024 13:47:14 -0500
Message-ID: <ZpVushkGx0_nYIip@nathan> (raw)
In-Reply-To: <CA+TgmoYUhRa8j8_Jdrb9Ankz=c8NRLe_x1nf4L+Vc2V+DiTSWw@mail.gmail.com>
References: <802ff3d5-fdc7-4b08-9046-2e9fc5fdae0e@oss.nttdata.com>
	<CA+TgmoYPNfgAT3OubjoYSiXTb3-urOjQxT3SCEUCrRBx5g6ihA@mail.gmail.com>
	<CA+TgmoY8DnzWNK_xu4=NTYdxGBGnFucrEpOALnS0awMp-s_pKQ@mail.gmail.com>
	<7c1b48d8-0f08-4733-a4e6-d55f04581db7@oss.nttdata.com>
	<CA+TgmoansG0B8ayQGw9Ozee6Jawz=HFUACpO_4gp-+SFJBxiYw@mail.gmail.com>
	<CA+TgmoZ53ADUm2UAGEspMuv-Db5SGtrOXUx=ps6LcGexsf5-fA@mail.gmail.com>
	<e2549085-5246-4edc-bc62-ae19df48acc5@oss.nttdata.com>
	<CA+TgmoYFOWbxk=FP+ZnxwVaKQEce=+0Xvzh0DUC9=YLNHiQW1w@mail.gmail.com>
	<8a668c51-c6af-4744-a978-c6a2ce3b1d83@oss.nttdata.com>
	<CA+TgmoYUhRa8j8_Jdrb9Ankz=c8NRLe_x1nf4L+Vc2V+DiTSWw@mail.gmail.com>

On Mon, Jul 15, 2024 at 02:30:42PM -0400, Robert Haas wrote:
> On Sun, Jul 14, 2024 at 10:56 PM Fujii Masao
> <masao.fujii@oss.nttdata.com> wrote:
>> I don't think it's a rare scenario since summarize_wal can be enabled
>> after starting the server with wal_level=minimal. Therefore, I believe
>> such a configuration should be prohibited using a GUC check hook,
>> as my patch does.
> 
> I guess I'm in the group of people who doesn't understand how this can
> possibly work. There's no guarantee about the order in which GUC check
> hooks are called, so you don't know if the value of the other variable
> has already been set to the final value or not, which seems like a
> fatal problem even if the code happens to work correctly as of today.
> Even if you have such a guarantee, you can't prohibit a configuration
> change at pg_ctl reload time: the server can refuse to start in case
> of an invalid configuration, but a running server can't decide to shut
> down or stop working at reload time.

My understanding is that the correctness of this GUC check hook depends on
wal_level being a PGC_POSTMASTER GUC.  The check hook would always return
true during startup, and there'd be an additional cross-check in
PostmasterMain() that would fail startup if necessary.  After that point,
we know that wal_level cannot change, so the GUC check hook for
summarize_wal can depend on wal_level.  If it fails, my expectation would
be that the server would just ignore that change and continue.

-- 
nathan





view thread (44+ messages)  latest in thread

Message-ID: <ZpVushkGx0_nYIip@nathan>
Permalink:  ../ZpVushkGx0_nYIip@nathan/
Also on:    postgresql.org/message-id/ZpVushkGx0_nYIip@nathan

 · 

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 using the --to and --cc options:
  reply via email

  To: pgsql-hackers@postgresql.org
  Cc: nathandbossart@gmail.com, robertmhaas@gmail.com, masao.fujii@oss.nttdata.com, pgsql-hackers@lists.postgresql.org
  Subject: Re: Add a GUC check hook to ensure summarize_wal cannot be enabled when wal_level is minimal
  In-Reply-To: <ZpVushkGx0_nYIip@nathan>

* 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