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

From: Michael Paquier <michael(at)paquier(dot)xyz>
To: Denis Laxalde <denis(dot)laxalde(at)dalibo(dot)com>
Cc: Julien Rouhaud <rjuju123(at)gmail(dot)com>, Jehan-Guillaume de Rorthais <jgdr(at)dalibo(dot)com>, Andres Freund <andres(at)anarazel(dot)de>, pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Re: [PATCH] Disable bgworkers during servers start in pg_upgrade
Date: 2021-08-25 05:27:30
Message-ID: YSXUwqCdhJWjPl1S@paquier.xyz
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Tue, Aug 24, 2021 at 04:40:02PM +0200, Denis Laxalde wrote:
> Julien Rouhaud a écrit :
>> I don't think that it would add that much complexity or overhead as there's
>> already all the infrastructure to prevent WAL writes in certain condition. It
>> should be enough to add an additional test in XLogInsertAllowed() with some new
>> variable that is set when starting in binary upgrade mode, and a new function
>> to disable it that will be emitted by pg_dump / pg_dumpall in binary upgrade
>> mode.
>
> This part is less clear to me so I'm not sure I'd be able to work on it.

default_transaction_read_only brings in a certain level of safety, but
it is limited when it comes to operations involving maintenance like a
REINDEX or a VACUUM code path. Making use of a different way to
control if WAL should be allowed for binary upgrades with a new mean
looks like a more promising and more robust approach, even if that
means that any bgworkers started by the clusters on which the upgrade
is done would need to deal with any errors generated by this new
facility.

Saying that, I don't see a scenario where we'd need a bgworker to be
around during an upgrade. But perhaps some cloud providers have this
need in their own golden garden?

> @@ -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?
--
Michael

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Amit Kapila 2021-08-25 05:27:54 Re: row filtering for logical replication
Previous Message Noah Misch 2021-08-25 05:21:40 Re: replay of CREATE TABLESPACE eats data at wal_level=minimal