pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Fujii Masao <masao.fujii@oss.nttdata.com>
Cc: Hayato Kuroda (Fujitsu) <kuroda.hayato@fujitsu.com>
Cc: Andy Fan <zhihuifan1213@163.com>
Cc: 'Michael Paquier' <michael@paquier.xyz>
Cc: PostgreSQL Hackers <pgsql-hackers@postgresql.org>
Subject: Re: A assert failure when initdb with track_commit_timestamp=on
Date: Fri, 04 Jul 2025 11:30:17 -0400
Message-ID: <249358.1751643017@sss.pgh.pa.us> (raw)
In-Reply-To: <efd05511-0b1f-4800-9eca-aadbf9bf5375@oss.nttdata.com>
References: <87plejmnpy.fsf@163.com>
	<1f8f703d-72e8-4d05-ab16-ff0403a1d19d@oss.nttdata.com>
	<aGXZL0oraweaENrF@paquier.xyz>
	<OSCPR01MB14966207D000875CA4F4C9FEAF543A@OSCPR01MB14966.jpnprd01.prod.outlook.com>
	<87o6u19z9w.fsf@163.com>
	<3694f39a-7148-4197-91fe-25f3d01222b7@oss.nttdata.com>
	<OSCPR01MB1496673E2FC58836331748DB6F542A@OSCPR01MB14966.jpnprd01.prod.outlook.com>
	<efd05511-0b1f-4800-9eca-aadbf9bf5375@oss.nttdata.com>

Fujii Masao <masao.fujii@oss.nttdata.com> writes:
> On 2025/07/04 16:29, Hayato Kuroda (Fujitsu) wrote:
>> If more GUCs were found which cannot be set during the bootstrap mode, how about
>> introducing a new flag like GUC_DEFAULT_WHILE_BOOTSTRAPPING for GUC variables?
>> If the flag is set all setting can be ignored when
>> IsBootstrapProcessingMode() = true.

> If there are many GUCs that behave incorrectly during bootstrap,
> a general mechanism like that might be worth considering. But if
> only a few GUCs are affected, as I believe is the case,
> then such a mechanism may be overkill.

As I remarked in the other thread, I don't like inventing a different
solution for each GUC.  So if there are even two that need something
done, I think Hayato-san's idea has merit.

The core of the patch could be as little as

diff --git a/src/backend/utils/misc/guc.c b/src/backend/utils/misc/guc.c
index 667df448732..43f289924e6 100644
--- a/src/backend/utils/misc/guc.c
+++ b/src/backend/utils/misc/guc.c
@@ -3464,6 +3464,15 @@ set_config_with_handle(const char *name, config_handle *handle,
 		return 0;
 	}
 
+	/*
+	 * Certain GUCs aren't safe to enable during bootstrap mode.  Silently
+	 * ignore attempts to set them to non-default values.
+	 */
+	if (unlikely(IsBootstrapProcessingMode()) &&
+		(record->flags & GUC_IGNORE_IN_BOOTSTRAP) &&
+		source != PGC_S_DEFAULT)
+		changeVal = false;
+
 	/*
 	 * Check if the option can be set at this time. See guc.h for the precise
 	 * rules.

If we went this way, we'd presumably revert 5a6c39b6d in favor
of marking track_commit_timestamp with this flag.

			regards, tom lane





view thread (28+ messages)  latest in thread

Message-ID: <249358.1751643017@sss.pgh.pa.us>
Permalink:  ../249358.1751643017@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/249358.1751643017@sss.pgh.pa.us

 · 

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: tgl@sss.pgh.pa.us, masao.fujii@oss.nttdata.com, kuroda.hayato@fujitsu.com, zhihuifan1213@163.com, michael@paquier.xyz
  Subject: Re: A assert failure when initdb with track_commit_timestamp=on
  In-Reply-To: <249358.1751643017@sss.pgh.pa.us>

* 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