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 1sTR9K-00GGGt-BT for pgsql-hackers@arkaria.postgresql.org; Mon, 15 Jul 2024 19:14:14 +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 1sTR9I-00CWeH-TB for pgsql-hackers@arkaria.postgresql.org; Mon, 15 Jul 2024 19:14:12 +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 1sTR9I-00CWe9-Jd for pgsql-hackers@lists.postgresql.org; Mon, 15 Jul 2024 19:14:12 +0000 Received: from mail-io1-xd29.google.com ([2607:f8b0:4864:20::d29]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1sTR9F-002DNF-MJ for pgsql-hackers@lists.postgresql.org; Mon, 15 Jul 2024 19:14:11 +0000 Received: by mail-io1-xd29.google.com with SMTP id ca18e2360f4ac-8036ce66164so190544839f.3 for ; Mon, 15 Jul 2024 12:14:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1721070849; x=1721675649; 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=dnvwDbSNz8LzQqzqDKZy0qSRxy91myKqTC7qDPiKfTc=; b=kuVCnYdAfY+d9+MZHzkUfVEQG1xT75nGN+dd1Ee2wrlNqxxLcqDkH5pIpxIRgj3s1k GKDY14BaFCv3qFWi/x9Tb1TRf4VneLYAtcDDAUEm6W8W20ToZfg51Ec1CxOWb/UAqcSd C2any/Hsgb5VcF/jXZXnsBhSmeo7vxNAteNW8T9aPrjsy3cYwUFL4/l7W5yKow3EmaTg cDMqnBHb83aGwYNuwEY9hfuxJM5sH50w+8bH+sljbqgTnL92XQ89WEUJVdFRCefVtu5o sise6mTbnYcx5r4BN83cVKWxmGweplSSybQkN/v8Zg3hcOb2GkzqV7XcUXVXi1BPxlTn I/KA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1721070849; x=1721675649; 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=dnvwDbSNz8LzQqzqDKZy0qSRxy91myKqTC7qDPiKfTc=; b=DN2UjcTiTVvBd0+0qz/s2QgHowHUVpzLoxmxSzsXEZn+42cA/oFubQPXgyBUrkT+hG KoUCpfk+9A4xBURBr3u9ceSb8h2Ly/trONY4umdYuIXBowJKROkpL/CQAV8Fbp1uGUpe FfFyqQxyjzuUhs7EyFWUf2jYZW9STpRiX+koeoIM5IDv3hIITIEF6ApCFXLmJi3Ho+I7 Bd/M+sdTWG0vuR/31fg35a4JyoEdOi4VkmOB8Rl4dM1K0spSTHK2RaUAscsKY1PUO9Ot CaacJbTkGIiToaCnIeLnnga/bbJJDRuXX/Cx47hGT7oyqVcPd37fcJY3gulT6P6/cNs4 vsAQ== X-Forwarded-Encrypted: i=1; AJvYcCXqUON0FOPlpHKbxz4skVstpFRcB3/+S0Znft95pP3kdxnqIkN78UVUQHLqObbcHVKLlr1CIS6DJ/XeE+Mw7mK8bID/t0pAfznpd7cf2KMygJXQ X-Gm-Message-State: AOJu0YydgtAoe3cAXC8ca28e2y22DN5WT6KXjTgtNWN8muYEcxXJs+MT DhOAURGwACw9Yc9ALCi0Vnglw6xyRmVbwFp5gq4I6UEPThTPDEPk X-Google-Smtp-Source: AGHT+IEA4CrVzsUBtRApD7wxZC7P6LR+OOQtMyVmR7NzsspakGPF2Qb2AY6SSxVa43MHXW7r2dtQkQ== X-Received: by 2002:a05:6602:2cc6:b0:803:5e55:ecb0 with SMTP id ca18e2360f4ac-815718a8478mr17003939f.0.1721070848643; Mon, 15 Jul 2024 12:14:08 -0700 (PDT) Received: from nathan (162-195-168-172.lightspeed.stlsmo.sbcglobal.net. [162.195.168.172]) by smtp.gmail.com with ESMTPSA id 8926c6da1cb9f-4c1e1b2d8d9sm1332466173.52.2024.07.15.12.14.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 15 Jul 2024 12:14:08 -0700 (PDT) Date: Mon, 15 Jul 2024 14:14:06 -0500 From: Nathan Bossart To: Robert Haas Cc: 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: <7c1b48d8-0f08-4733-a4e6-d55f04581db7@oss.nttdata.com> <8a668c51-c6af-4744-a978-c6a2ce3b1d83@oss.nttdata.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Mon, Jul 15, 2024 at 01:47:14PM -0500, Nathan Bossart wrote: > On Mon, Jul 15, 2024 at 02:30:42PM -0400, Robert Haas wrote: >> 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. I should also note that since wal_level defaults to "replica", I don't think we even need any extra "always return true on startup" logic. If wal_level is set prior to summarize_wal, the check hook will fail startup as needed. If summarize_wal is set first, the check hook will return true, and we'll fall back on the PostmasterMain() check (that already exists). In short, the original patch [0] seems like it should work in this particular scenario, barring some corner case I haven't discovered. That being said, it's admittedly fragile and probably not a great precedent to set. I've been thinking about some ideas for more generic GUC dependency tooling, but I don't have anything to share yet. [0] https://postgr.es/m/attachment/161852/v1-0001-Prevent-summarize_wal-from-enabling-when-wal_leve.patch -- nathan