Re: [PATCH] Disable bgworkers during servers start in pg_upgrade

From: Julien Rouhaud <rjuju123(at)gmail(dot)com>
To: Andres Freund <andres(at)anarazel(dot)de>
Cc: Michael Paquier <michael(at)paquier(dot)xyz>, Bruce Momjian <bruce(at)momjian(dot)us>, Daniel Gustafsson <daniel(at)yesql(dot)se>, Denis Laxalde <denis(dot)laxalde(at)dalibo(dot)com>, Jehan-Guillaume de Rorthais <jgdr(at)dalibo(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: [PATCH] Disable bgworkers during servers start in pg_upgrade
Date: 2021-08-28 01:41:10
Message-ID: CAOBaU_aSSbmR8OcJ_jP9QQz5kYewp78jFGF8E=9FKt1V-At7qg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Sat, Aug 28, 2021 at 3:28 AM Andres Freund <andres(at)anarazel(dot)de> wrote:
>
> > On Fri, Aug 27, 2021 at 7:31 AM Michael Paquier <michael(at)paquier(dot)xyz> wrote:
> >
> > > Wouldn't it be better to block things at the source, as of
> > > RegisterBackgroundWorker()? And that would keep track of the control
> > > we have on bgworkers in a single place. I also think that we'd better
> > > document something about that either in bgworker.sgml or pg_upgrade's
> > > page.
>
> Isn't that just going to end up with extension code erroring out and/or
> blocking waiting for a bgworker to start?

But there's no API to wait for the start of a non-dynamic bgworker or
check for it right? So I don't see how the extension code could wait
or error out. As far as I know the only thing you can do is
RegisterBackgroundWorker() in your _PG_init() code and hope that the
server is correctly configured. The only thing that third-party code
could I think is try to check if the bgworker could be successfully
registered or not as I mentioned in [1]. Maybe extra paranoid code
may add such check in all executor hook but the overhead would be so
terrible that no one would use such an extension anyway.

[1] https://www.postgresql.org/message-id/CAOBaU_ZtR88x3Si6XwprqGo8UZNLncAQrD_-wc67sC=acO3g=w@mail.gmail.com

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Julien Rouhaud 2021-08-28 01:43:42 Re: [PATCH] Disable bgworkers during servers start in pg_upgrade
Previous Message Michael Paquier 2021-08-28 01:40:42 Re: [PATCH] Disable bgworkers during servers start in pg_upgrade