Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1sRZzG-00GfWd-Br for pgsql-hackers@arkaria.postgresql.org; Wed, 10 Jul 2024 16:16:10 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1sRZzE-0074UD-FI for pgsql-hackers@arkaria.postgresql.org; Wed, 10 Jul 2024 16:16:08 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1sRZzE-0074Ty-5h for pgsql-hackers@lists.postgresql.org; Wed, 10 Jul 2024 16:16:08 +0000 Received: from mail-io1-xd35.google.com ([2607:f8b0:4864:20::d35]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1sRZz8-001Ols-Dy for pgsql-hackers@lists.postgresql.org; Wed, 10 Jul 2024 16:16:06 +0000 Received: by mail-io1-xd35.google.com with SMTP id ca18e2360f4ac-8036ce66164so59352639f.3 for ; Wed, 10 Jul 2024 09:16:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1720628161; x=1721232961; darn=lists.postgresql.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=HADlNibsGfnJZ0yL85aVhj+zDoAjmDUJwQgpV5YQfN8=; b=MaeN8kgqLX9nS3E0vHG6zcPBji8Ntz3cFckry4aOAVnB7E08PjOJDFKh6jFsvUJHrn g1tL5ARuPb46ezahx6Ndp4UF8rCgHsKSRVABsOqnc0CQTUlEreGY/lbGQE643bRhP4Ql gVTheRB73KTILx6XIr/6cxAEHEJwoQuKCw4uVKqaE1qKPJ27l+E86ytVYzHxFRYxg+Xw +NQgKo7RM9QGzDAHk3dHfsmKY5FUXvasmpuTZv+vdT+bMX68v9/MgPm51z46KUp3cqxi BKZMGHhlSRPImmsNdm5cCwAZyr9nOIQr4ykFNKZdkmFvb8F5mRSICwCIBOJIT/PtWI7v ZU+w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1720628161; x=1721232961; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=HADlNibsGfnJZ0yL85aVhj+zDoAjmDUJwQgpV5YQfN8=; b=URH7D7nHTpLUSVihcgIwikd2awN4PDeEsXI1u05R6X4pSTww3yLhrRwNw12ne8b/Nj 9NMp8H56Ky3OUqEK1J2lc9wob0d3QBFPHy+XQpdrTDL6tD9JHZOpUawIwZqcaN02LYZJ 9DCGMUaWYXtMTxfg8m2vBqRPyIcLUBEiQmSHLuRgSEumI15yYNXc8rpChpxKSnsodUdx p41vDDcTknOD+iU9TdFg0haVvFdbaZgMnBflo1iodB7x7fwGKwiqgMx6YD4N1QBaCN6W ooPhN70WiEia4hqbrDzlLVrbggDDC2qxh40BX0rHDcIB+qs+MzeGMN7fneFROcXbKwJv XXWw== X-Forwarded-Encrypted: i=1; AJvYcCXHPma1tpDg/NYjFyKIH8xPtXyVTtlWq9BWg5azWypd4DGnIpriNPogPLShaUfEuKM/ucoCE0vF5t6fw4fQmTnIem6ZAZLCvInWbwbn4/xN+1mR X-Gm-Message-State: AOJu0YwX1IXfVoN97vHSGbCkXIekUEieni6SuCDwF8Gq/2Gg79WZpTgq IKXyug3CzcntLPySXwTVikVGrnwzUPHA+5XfNw2tqtr5birFgE1m X-Google-Smtp-Source: AGHT+IHdb/wJR8i4hYWqAT1Sx5H1gTzSQcAmne7WU1EPpuuf3bioKtW+uwO7Ev1qNlJtzGMSRQim7g== X-Received: by 2002:a6b:dd03:0:b0:7f6:8714:d93d with SMTP id ca18e2360f4ac-800034fd83cmr604853939f.20.1720628161495; Wed, 10 Jul 2024 09:16:01 -0700 (PDT) Received: from nathan (162-195-168-172.lightspeed.stlsmo.sbcglobal.net. [162.195.168.172]) by smtp.gmail.com with ESMTPSA id ca18e2360f4ac-7ffea75724asm128036639f.33.2024.07.10.09.16.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 10 Jul 2024 09:16:01 -0700 (PDT) Date: Wed, 10 Jul 2024 11:15:59 -0500 From: Nathan Bossart To: Tom Lane Cc: Jelte Fennema-Nio , Robert Haas , Fujii Masao , pgsql-hackers@lists.postgresql.org Subject: Re: Add a GUC check hook to ensure summarize_wal cannot be enabled when wal_level is minimal Message-ID: References: <802ff3d5-fdc7-4b08-9046-2e9fc5fdae0e@oss.nttdata.com> <7c1b48d8-0f08-4733-a4e6-d55f04581db7@oss.nttdata.com> <1744272.1720624273@sss.pgh.pa.us> <1749638.1720626878@sss.pgh.pa.us> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1749638.1720626878@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Wed, Jul 10, 2024 at 11:54:38AM -0400, Tom Lane wrote: > Nathan Bossart writes: >> I haven't tested it, but from skimming around the code, it looks like >> ProcessConfigFileInternal() would deduplicate any previous entries in the >> file prior to applying the values and running the check hooks. Else, >> reloading a configuration file with multiple startup-only GUC entries could >> fail, even without bogus GUC check hooks. > > While it's been a little while since I actually traced the logic, > I believe the reason that case doesn't fail is this bit in > set_config_with_handle, about line 3477 as of HEAD: > > case PGC_POSTMASTER: > if (context == PGC_SIGHUP) > { > /* > * We are re-reading a PGC_POSTMASTER variable from > * postgresql.conf. We can't change the setting, so we should > * give a warning if the DBA tries to change it. However, > * because of variant formats, canonicalization by check > * hooks, etc, we can't just compare the given string directly > * to what's stored. Set a flag to check below after we have > * the final storable value. > */ > prohibitValueChange = true; > } > else if (context != PGC_POSTMASTER) > // throw "cannot be changed now" error That's what I thought at first, but then I saw this in ProcessConfigFileInternal(): /* If it's already marked, then this is a duplicate entry */ if (record->status & GUC_IS_IN_FILE) { /* * Mark the earlier occurrence(s) as dead/ignorable. We could * avoid the O(N^2) behavior here with some additional state, * but it seems unlikely to be worth the trouble. */ ConfigVariable *pitem; for (pitem = head; pitem != item; pitem = pitem->next) { if (!pitem->ignore && strcmp(pitem->name, item->name) == 0) pitem->ignore = true; } } -- nathan