Re: [PATCH] Disable bgworkers during servers start in pg_upgrade - Mailing list pgsql-hackers

From Julien Rouhaud
Subject Re: [PATCH] Disable bgworkers during servers start in pg_upgrade
Date
Msg-id CAOBaU_Zh5K_kjCAX+OnwRMQ68SHSVSR5haF9R0Ud8hXk31Wk+Q@mail.gmail.com
Whole thread Raw
In response to Re: [PATCH] Disable bgworkers during servers start in pg_upgrade  (Denis Laxalde <denis.laxalde@dalibo.com>)
Responses Re: [PATCH] Disable bgworkers during servers start in pg_upgrade  (Bruce Momjian <bruce@momjian.us>)
List pgsql-hackers
On Thu, Aug 26, 2021 at 3:15 PM Denis Laxalde <denis.laxalde@dalibo.com> wrote:
>
> Michael Paquier a écrit :
> >> @@ -5862,6 +5862,9 @@ do_start_bgworker(RegisteredBgWorker *rw)
> >>   static bool
> >>   bgworker_should_start_now(BgWorkerStartTime start_time)
> >>   {
> >> +    if (IsBinaryUpgrade)
> >> +            return false;
> >> +
> > Using -c max_worker_processes=0 would just have the same effect, no?
> > So we could just patch pg_upgrade's server.c to get the same level of
> > protection?
>
> Yes, same effect indeed. This would log "too many background workers"
> messages in pg_upgrade logs, though.
> See attached patch implementing this suggestion.

I disagree.  It can appear to have the same effect but it's not
guaranteed.  Any module in shared_preload_libraries could stick a
"max_worker_processes +=X" if it thinks it should account for its own
ressources.  That may not be something encouraged, but it's definitely
possible (and I think Andres recently mentioned that some extensions
do things like that, although maybe for other GUCs) and could result
in a corruption of a pg_upgrade'd cluster, so I still think that
changing bgworker_should_start_now() is a better option.



pgsql-hackers by date:

Previous
From: Denis Smirnov
Date:
Subject: Re: Async-unsafe functions in signal handlers
Next
From: Kyotaro Horiguchi
Date:
Subject: cannot access to postgres-git via ssh