Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nJIjj-00016i-11 for pgsql-hackers@arkaria.postgresql.org; Sun, 13 Feb 2022 17:32:35 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1nJIjg-0006dP-PR for pgsql-hackers@arkaria.postgresql.org; Sun, 13 Feb 2022 17:32:32 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nJIjg-0006co-40 for pgsql-hackers@lists.postgresql.org; Sun, 13 Feb 2022 17:32:32 +0000 Received: from anastigmatix.net ([68.171.219.55]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nJIjY-0004aZ-Ts for pgsql-hackers@lists.postgresql.org; Sun, 13 Feb 2022 17:32:30 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=anastigmatix.net; s=default; h=Content-Transfer-Encoding:Content-Type: In-Reply-To:MIME-Version:Date:Message-ID:From:Cc:References:To:Subject:Sender :Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help: List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=GFztyTtvBqg4BQ6RiOotjJoOLluTJx1CVo94Sljo8TQ=; b=f/iqSGNyFKJ4eBl5XcZA94vOBZ kucXME8SXnIxIK6Yau7tBgDBDGF2Cv71kFKyyAUq5Gj+otkY0VyxbWeNFhty7Lgt2AmJ0/psNr2Qf HpWpAn8n77r2uyk7Bm5+ncypw7os2qFAL5puyHLpPx0/ALMxE0D6wYlthaygB22b0oG0CUnLkoskD 8hoFXJ9rH2hKuTYwfl4bn+8DJ8gh4uXem3QaCfiKXA/fJUslpNTfs0Ymv+rktYaAYFBx4lQq5JvR6 +DpMQpZysWIb5+yRXte4pDB/JQ/8tjRFIz80vH74VLnZRJ4ju5P/UrEW12weG0BXU+1eYkcjtYA+z vpngrD8Q==; Received: from 50-102-16-206.prtg.in.frontiernet.net ([50.102.16.206]:58818) by bay.acenet.us with esmtpsa (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1nJIjW-001I6c-6S; Sun, 13 Feb 2022 12:32:23 -0500 Subject: Re: Mark all GUC variable as PGDLLIMPORT To: Julien Rouhaud , Andres Freund References: <20210822081033.kx6op325sbd24cw5@nol> <20210822120743.lvazjchtns5sezb2@nol> <2210220.1629638382@sss.pgh.pa.us> <20210822132901.ztlervolfdbqypw4@nol> <20210823065334.6jpx4ux7l2maggvf@nol> <20220213035956.bi6xumusrcog5wsb@alap3.anarazel.de> <20220213072931.dxfdumusodlrkxyf@jrouhaud> Cc: Tom Lane , Michael Paquier , pgsql-hackers@lists.postgresql.org From: Chapman Flack X-Enigmail-Draft-Status: N1110 Message-ID: <620940A4.5010900@anastigmatix.net> Date: Sun, 13 Feb 2022 12:32:20 -0500 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.7.0 MIME-Version: 1.0 In-Reply-To: <20220213072931.dxfdumusodlrkxyf@jrouhaud> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - bay.acenet.us X-AntiAbuse: Original Domain - lists.postgresql.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - anastigmatix.net X-Get-Message-Sender-Via: bay.acenet.us: authenticated_id: chap@anastigmatix.net X-Authenticated-Sender: bay.acenet.us: chap@anastigmatix.net X-Source: X-Source-Args: X-Source-Dir: X-From-Rewrite: unmodified, already matched List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Hi, On 02/13/22 02:29, Julien Rouhaud wrote: > Maybe we could have an actually usable GUC API to retrieve values in their > native format rather than C string for instance, that we could make sure also > works for cases like max_backend? I proposed a sketch of such an API for discussion back in [0] (the second idea in that email, the "what I'd really like" one). In that scheme, some extension code that was interested in (say, for some reason) log_statement_sample_rate could say: static double samprate; static int gucs_changed = 0; #define SAMPRATE_CHANGED 1 ... ObserveTypedConfigValue("log_statement_sample_rate", &samprate, &gucs_changed, SAMPRATE_CHANGED); ... and will be subscribed to have the native-format value stored into samprate, and SAMPRATE_CHANGED ORed into gucs_changed, whenever the value changes. The considerations leading me to that design were: - avoid subscribing as a 'callback' sort of listener. GUCs can get set (or, especially, reset) in delicate situations like error recovery where calling out to arbitrary extra code might best be avoided. - instead, just dump the value in a subscribed location. A copy, of course, so no modification there affects the real value. - but at the same time, OR a flag into a bit set, so subscribing code can very cheaply poll for when a value of interest (or any of a bunch of values of interest) has changed since last checked. - do the variable lookup by name once only, and pay no further search cost when the subscribing code wants the value. I never pictured that proposal as the last word on the question, and different proposals could result from putting different weights on those objectives, or adding other objectives, but I thought it might serve as a discussion-starter. Regards, -Chap [0] https://www.postgresql.org/message-id/6123C425.3080409%40anastigmatix.net