pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Julien Rouhaud <rjuju123@gmail.com>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: Nathan Bossart <nathandbossart@gmail.com>
Cc: Robert Haas <robertmhaas@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: Tue, 19 Apr 2022 17:49:13 +0800
Message-ID: <Yl6FmT4qXTA7/NJm@jrouhaud> (raw)
In-Reply-To: <2470289.1650327424@sss.pgh.pa.us>
References: <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>
	<20220419001220.GA2389330@nathanxps13>
	<2470289.1650327424@sss.pgh.pa.us>

Hi,

On Mon, Apr 18, 2022 at 08:17:04PM -0400, Tom Lane wrote:
> Nathan Bossart <nathandbossart@gmail.com> writes:
> > 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.
> 
> If they do that and it breaks something, that's their fault not ours.
> (It's not like there's not $BIGNUM ways for a C-language module to
> break the backend, anyway.)

Agreed.  Similarly the process_shared_preload_libraries_in_progress flag could
be modified by extension, and that wouldn't be any better.

> BTW, I'd make such errors FATAL, as it's unlikely that we can recover
> cleanly from an error during initialization of a loadable module.
> The module's likely to be only partially initialized/hooked in.

While at it, should we make process_shmem_requests_in_progress true when the
new hook is called?  The hook should only be called when that's the case, and
extension authors may feel like asserting it.





view thread (132+ messages)  latest in thread

Message-ID: <Yl6FmT4qXTA7/NJm@jrouhaud>
Permalink:  ../Yl6FmT4qXTA7%2FNJm@jrouhaud/
Also on:    postgresql.org/message-id/Yl6FmT4qXTA7/NJm@jrouhaud

 · 

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: rjuju123@gmail.com, tgl@sss.pgh.pa.us, nathandbossart@gmail.com, robertmhaas@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: <Yl6FmT4qXTA7/NJm@jrouhaud>

* 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