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 1rIYcD-009P4q-KU for pgsql-hackers@arkaria.postgresql.org; Wed, 27 Dec 2023 18:26:49 +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 1rIYcC-008UBr-A6 for pgsql-hackers@arkaria.postgresql.org; Wed, 27 Dec 2023 18:26:48 +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 1rIYcC-008UBi-0J for pgsql-hackers@lists.postgresql.org; Wed, 27 Dec 2023 18:26:48 +0000 Received: from mail-oi1-x22c.google.com ([2607:f8b0:4864:20::22c]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1rIYc9-00CTmI-3q for pgsql-hackers@lists.postgresql.org; Wed, 27 Dec 2023 18:26:46 +0000 Received: by mail-oi1-x22c.google.com with SMTP id 5614622812f47-3b9f727d94cso1738254b6e.1 for ; Wed, 27 Dec 2023 10:26:45 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=neon.tech; s=google; t=1703701604; x=1704306404; darn=lists.postgresql.org; h=in-reply-to:references:to:subject:from:message-id:date :content-transfer-encoding:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=DBlCeU+rQ7Okqzz9HUp8q0iLSLF6LDW4Idv4AUeq0eY=; b=Vb86chC6mxf7WpWXFRNtENGCx5WVo5TdVCShnHM/1JPZYXsVloxZivyzDlFXFXun3g J1Ha8Cwj5reH0rCxBRSDMiuEVf4y8Xmh8E6emzEYq6W7Thh5o15kJCMMS7DHOv2o6DRq 0AI39uZ0sYDV79NQrQfuSfJMaZEVeWnCXE9Lg= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1703701604; x=1704306404; h=in-reply-to:references:to:subject:from:message-id:date :content-transfer-encoding:mime-version:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=DBlCeU+rQ7Okqzz9HUp8q0iLSLF6LDW4Idv4AUeq0eY=; b=NsmHlOFx/WZ+BrtAbW4ufqZle5muB0iSen1VZpcCpWlq8NtgOxLyQNdkEPsObaCklY KotLfcqxtT08tAlwrlNlpT7fGf9LxE+vtUOGRmYHxbjao/YbVut4hoz/nslY2+ebFsJ+ kzPO5qTjDBNR4oE5mfnFGe7RO+zxg8940ugO14f1wyHKZvjX2kwUp+JKWpdAw0+yhVlI PpjlQy5ulhdNHkRD2gjKSaH/bvl1M9Bv4yIn9SbJbwbs/AN8I/oexy4F8cVevjOsg6vz kliNTXaXc6jA8gFLMN9E2n91Ps3Zb+JvULLf0c7PM41kCyF+xp8hs90WL44jxQmvo7Qs sLsg== X-Gm-Message-State: AOJu0YyiuNVULWSW6d2T1CjLORfSbB2kz2Jibk4dFL2bKxkIdONGFN1o p8uGcqOj7S/mCYBN6tULiwWI3TjBxiOscg== X-Google-Smtp-Source: AGHT+IF9dinJe53G/6FRVvw1PT3mMvlrytkhSKAn6peTX4Zayw4fZ6GTynjqYmlD6sYS/gujgfQyKw== X-Received: by 2002:a05:6808:120c:b0:3b2:e34f:349b with SMTP id a12-20020a056808120c00b003b2e34f349bmr4942389oil.42.1703701604357; Wed, 27 Dec 2023 10:26:44 -0800 (PST) Received: from localhost ([172.56.50.237]) by smtp.gmail.com with ESMTPSA id k15-20020a05680808cf00b003bb817e3448sm1731339oij.46.2023.12.27.10.26.43 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 27 Dec 2023 10:26:44 -0800 (PST) Mime-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=UTF-8; format=Flowed Date: Wed, 27 Dec 2023 12:26:42 -0600 Message-Id: From: "Tristan Partin" Subject: Re: Two small bugs in guc.c To: "Tom Lane" , X-Mailer: aerc 0.16.0-93-gbd29700e708d References: <2089235.1703617353@sss.pgh.pa.us> In-Reply-To: <2089235.1703617353@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Tue Dec 26, 2023 at 1:02 PM CST, Tom Lane wrote: > I investigated the report at [1] about pg_file_settings not reporting > invalid values of "log_connections". It turns out it's broken for > PGC_BACKEND and PGC_SU_BACKEND parameters, but not other ones. > The cause is a bit of premature optimization in this logic: > > * If a PGC_BACKEND or PGC_SU_BACKEND parameter is change= d in > * the config file, we want to accept the new value in th= e > * postmaster (whence it will propagate to > * subsequently-started backends), but ignore it in exist= ing > * backends. ... > > Upon detecting that case, set_config_option just returns -1 immediately > without bothering to validate the value. It should check for invalid > input before returning -1, which we can mechanize with a one-line fix: > > - return -1; > + changeVal =3D false; > > While studying this, I also noted that the bit to prevent changes in > parallel workers seems seriously broken: > > if (IsInParallelMode() && changeVal && action !=3D GUC_ACTION_SAVE) > ereport(elevel, > (errcode(ERRCODE_INVALID_TRANSACTION_STATE), > errmsg("cannot set parameters during a parallel operatio= n"))); > > This is evidently assuming that ereport() won't return, which seems > like a very dubious assumption given the various values that elevel > can have. Maybe it's accidentally true -- I don't recall any > reports of trouble here -- but it sure looks fragile. > > Hence, proposed patch attached. Looks good to me. -- Tristan Partin Neon (https://neon.tech)