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 1nWszf-0000Dk-AQ for pgsql-hackers@arkaria.postgresql.org; Wed, 23 Mar 2022 04:53:11 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1nWszd-0001gM-Ly for pgsql-hackers@arkaria.postgresql.org; Wed, 23 Mar 2022 04:53:09 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nWszd-0001fp-AZ for pgsql-hackers@lists.postgresql.org; Wed, 23 Mar 2022 04:53:09 +0000 Received: from mail-pj1-x1029.google.com ([2607:f8b0:4864:20::1029]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1nWszb-0004rx-5y for pgsql-hackers@lists.postgresql.org; Wed, 23 Mar 2022 04:53:08 +0000 Received: by mail-pj1-x1029.google.com with SMTP id o68-20020a17090a0a4a00b001c686a48263so2987826pjo.1 for ; Tue, 22 Mar 2022 21:53:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=Bzg7WczjK+hq0Ab5Rv/hYxjRmysBGxatEmvMHWj5DUw=; b=kynicdJEsPvlXwtG/tHK4u1/VNr5Lb+MYMoB490+Wkidxjx8hg/8Xn86EAj9RDdzVY k5PnkIIoKIr8+ErIPWBk5P6DYtAcONd70Ld2gMu9ZXZz7/NzxpDi/K/9SwedwGkAqkIM 1XcB3LI5qnY8MRudMfheRTG7X8k3OpcL4yZp68i83vA/OWkCQAowU/rnFrx1fvYnk2oL mLyTEC6vbRr3N6JT9QRfWsT+ZJzkP/RgR/QjpilFow4XjtNHhXLNApFqg2tJxeG/GeG1 k0PR2L8YWvt4W37DtfaD4rO7ItxumslM0E5dWyCE05ce/ZIU+m3UFNBzXaKzQd7/FtmN b4LQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=Bzg7WczjK+hq0Ab5Rv/hYxjRmysBGxatEmvMHWj5DUw=; b=imlrLKqNOGMpvMSc9Ktn181TlrVVXCq1FkhWWtivWAalk2fSMJS7N9LMqyEloGPdQV 8RdVmhXSmj0Zzcrr7dIE/lk9lT67nNnYn6s4Vjr8Ri+mwCejjQGmKWrRh6mN6iQIzQQZ DSLlNwmfGbJjZ878vI9k99VbPNV9ADLI2sLX75wJ+uAfNnOpPzGW4V+79qCkfxjQ5pi7 M8Sw/H471uS9bhSUHnhHtH6q0T/BSbiFBtTq7yphSzwYYZxJCqAD2CdzVpYGApip6bR/ BtsfP6tdFG6/0yJwxmExNbZZ6by2NB0B6hityRxGZv2OAVKbFMbQBzY4sH21V/KDEYhl 9Aog== X-Gm-Message-State: AOAM532YmXZZcs+mBpQ9aF1MgcBik26wq2Jt/uv/Mw9t7zUbSrmUYI2X yRtC0DvYbBHKbXsPrBLD1ck= X-Google-Smtp-Source: ABdhPJwRh7cBBTalPdGTlgPJBDKdwm4m9fd3iYFQIGCctvEO6Sg9uN1Y4QCssts0/dmxa3kQOm1qIg== X-Received: by 2002:a17:90a:ba15:b0:1c6:7873:b192 with SMTP id s21-20020a17090aba1500b001c67873b192mr9243905pjr.76.1648011184758; Tue, 22 Mar 2022 21:53:04 -0700 (PDT) Received: from jrouhaud (1-171-62-208.dynamic-ip.hinet.net. [1.171.62.208]) by smtp.gmail.com with ESMTPSA id o6-20020a17090ad20600b001b8d01566ccsm4324528pju.8.2022.03.22.21.53.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 22 Mar 2022 21:53:03 -0700 (PDT) Date: Wed, 23 Mar 2022 12:52:29 +0800 From: Julien Rouhaud To: Nathan Bossart Cc: Michael Paquier , Robert Haas , "Bossart, Nathan" , Fujii Masao , "wangsh.fnst@fujitsu.com" , Andres Freund , Bharath Rupireddy , Greg Sabino Mullane , Tom Lane , "pgsql-hackers@lists.postgresql.org" Subject: Re: make MaxBackends available in _PG_init Message-ID: <20220323045229.i23skfscdbvrsuxa@jrouhaud> References: <20220204201349.GA1534137@nathanxps13> <20220209175338.GB1627503@nathanxps13> <20220210192612.GA1684442@nathanxps13> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220210192612.GA1684442@nathanxps13> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Hi, Sorry for showing up this late, but I'm a bit confused with the new situation. Unless I'm missing something, the new situation is that the system is supposed to prevent access to MaxBackends during s_p_l_pg_init, for reasons I totally agree with, but without doing anything for extensions that actually need to access it at that time. So what are extensions supposed to do now if they do need the information during their _PG_init() / RequestAddinShmemSpace()? Note that I have two of such extensions. They actually only need it to give access to the queryid in the background workers since it's otherwise not available, but there's at least pg_wait_sampling extension that needs the value to request shmem for other needs. One funny note is that my extensions aren't using MaxBackends but instead compute it based on MaxConnections, autovacuum_max_workers and so on. So those two extensions aren't currently broken, or more accurately not more than they previously were. Is there any reasoning to not protect all the variables that contribute to MaxBackends?