pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Nathan Bossart <nathandbossart@gmail.com>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: Robert Haas <robertmhaas@gmail.com>
Cc: Julien Rouhaud <rjuju123@gmail.com>
Cc: Andres Freund <andres@anarazel.de>
Cc: Michael Paquier <michael@paquier.xyz>
Cc: Bossart, Nathan <bossartn@amazon.com>
Cc: Fujii Masao <masao.fujii@oss.nttdata.com>
Cc: wangsh.fnst@fujitsu.com <wangsh.fnst@fujitsu.com>
Cc: Bharath Rupireddy <bharath.rupireddyforpostgres@gmail.com>
Cc: Greg Sabino Mullane <htamfids@gmail.com>
Cc: pgsql-hackers@lists.postgresql.org <pgsql-hackers@lists.postgresql.org>
Subject: Re: make MaxBackends available in _PG_init
Date: Mon, 18 Apr 2022 17:12:20 -0700
Message-ID: <20220419001220.GA2389330@nathanxps13> (raw)
In-Reply-To: <2395586.1650324834@sss.pgh.pa.us>
References: <1100207.1649864342@sss.pgh.pa.us>
	<CA+TgmobVwPLaEq9UrKtnaoQiA+2LQg+NS8ANhXNGNBf+c_yvRw@mail.gmail.com>
	<1102589.1649865908@sss.pgh.pa.us>
	<20220413183040.GA2116671@nathanxps13>
	<Yle2IBsS1Nnp2WWa@jrouhaud>
	<20220414162215.GB2163833@nathanxps13>
	<CA+TgmoYCK9TKxKT_39S7SVD56rgcffFOozzUso2kxStsmvwZRQ@mail.gmail.com>
	<1522578.1649954386@sss.pgh.pa.us>
	<20220418225244.GA2387491@nathanxps13>
	<2395586.1650324834@sss.pgh.pa.us>

On Mon, Apr 18, 2022 at 07:33:54PM -0400, Tom Lane wrote:
> Nathan Bossart <nathandbossart@gmail.com> writes:
>> I noticed that requests for more LWLocks follow a similar pattern as
>> regular shared memory requests, and I figured that we would want to do
>> something similar for those, but I wasn't sure exactly how to proceed.  I
>> saw two options: 1) use shmem_request_hook for both regular requests and
>> LWLock requests or 2) introduce an lwlock_request_hook.  My instinct was
>> that option 1 was preferable,
> 
> Yeah, I agree, which says that maybe the hook name needs to be something
> else (not that I have a good proposal).
> 
>> but AFAICT this requires introducing a new
>> external variable for inspecting whether the request is made at a valid
>> time.
> 
> Uh, why?  It'd be the core code's responsibility to place the hook
> call at a point where you could do both.

I'm looking for a clean way to ERROR if someone attempts to call
RequestAddinShmemSpace() or RequestNamedLWLockTranche() outside of the
hook.  Currently, we are using static variables in ipci.c and lwlock.c to
silently ignore invalid requests.  I could add a new 'extern bool' called
'process_shmem_requests_in_progress', but extensions could easily hack
around that to allow requests in _PG_init().  Maybe I am overthinking all
this and that is good enough.

-- 
Nathan Bossart
Amazon Web Services: https://aws.amazon.com





view thread (132+ messages)  latest in thread

Message-ID: <20220419001220.GA2389330@nathanxps13>
Permalink:  ../20220419001220.GA2389330@nathanxps13/
Also on:    postgresql.org/message-id/20220419001220.GA2389330@nathanxps13

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-hackers@postgresql.org
  Cc: nathandbossart@gmail.com, tgl@sss.pgh.pa.us, robertmhaas@gmail.com, rjuju123@gmail.com, andres@anarazel.de, michael@paquier.xyz, bossartn@amazon.com, masao.fujii@oss.nttdata.com, wangsh.fnst@fujitsu.com, bharath.rupireddyforpostgres@gmail.com, htamfids@gmail.com, pgsql-hackers@lists.postgresql.org
  Subject: Re: make MaxBackends available in _PG_init
  In-Reply-To: <20220419001220.GA2389330@nathanxps13>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox