From: Tom Lane <tgl@sss.pgh.pa.us>
To: Michael Paquier <michael@paquier.xyz>
Cc: Bharath Rupireddy <bharath.rupireddyforpostgres@gmail.com>
Cc: Drouvot, Bertrand <bertranddrouvot.pg@gmail.com>
Cc: PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>
Cc: Andres Freund <andres@anarazel.de>
Subject: Re: Add a new BGWORKER_BYPASS_ROLELOGINCHECK flag
Date: Mon, 09 Oct 2023 23:11:58 -0400
Message-ID: <240194.1696907518@sss.pgh.pa.us> (raw)
In-Reply-To: <ZSSAvZNDYZgrNvfX@paquier.xyz>
References: <83f72bb9-f3cf-4344-8d4d-45e128813d58@gmail.com>
<ZR5FRByOl2y8dORo@paquier.xyz>
<26e7cd6a-6dd1-4b08-975b-62603eeb6f3f@gmail.com>
<CALj2ACUJf8ftjiTiNfuVKTvUM3N++dWKnhBOg1EJ29CwoTkXew@mail.gmail.com>
<ZR9QJrNJ8lJDZ41P@paquier.xyz>
<ZR-pSNRTY2izuNdg@paquier.xyz>
<ZR_AESc5tptmpP9t@paquier.xyz>
<3365937.1696801735@sss.pgh.pa.us>
<ZSPJ0dKz4fdjFs5n@paquier.xyz>
<159529.1696868418@sss.pgh.pa.us>
<ZSSAvZNDYZgrNvfX@paquier.xyz>
Michael Paquier <michael@paquier.xyz> writes:
> On Mon, Oct 09, 2023 at 12:20:18PM -0400, Tom Lane wrote:
>> There will be a window where the worker has logged "database
>> "noconndb" is not currently accepting connections" but hasn't yet
>> exited, so that conceivably this query could see a positive count.
> I don't think that's possible here. The check on datallowconn is done
> before a backend calls pgstat_bestart() which would make its backend
> entry reported to pg_stat_activity. So there is no window where a
> backend would be in pg_stat_activity if this check fails.
Ah, right. I complained after seeing that we set MyProc->databaseId
before doing CheckMyDatabase, but you're right that it doesn't
matter for pg_stat_activity until pgstat_bestart.
> Saying that, I'm OK with just dropping this query, as it could also be
> possible that one decides that calling pgstat_bestart() before the
> datallowconn check is a good idea for a reason or another.
Not sure if that's a likely change or not. However, if we're in
agreement that this test step isn't buying much, let's just drop
it and save the test cycles.
regards, tom lane
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 from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-hackers@postgresql.org
Cc: tgl@sss.pgh.pa.us, michael@paquier.xyz, bharath.rupireddyforpostgres@gmail.com, bertranddrouvot.pg@gmail.com, andres@anarazel.de
Subject: Re: Add a new BGWORKER_BYPASS_ROLELOGINCHECK flag
In-Reply-To: <240194.1696907518@sss.pgh.pa.us>
References: <83f72bb9-f3cf-4344-8d4d-45e128813d58@gmail.com> <ZR5FRByOl2y8dORo@paquier.xyz> <26e7cd6a-6dd1-4b08-975b-62603eeb6f3f@gmail.com> <CALj2ACUJf8ftjiTiNfuVKTvUM3N++dWKnhBOg1EJ29CwoTkXew@mail.gmail.com> <ZR9QJrNJ8lJDZ41P@paquier.xyz> <ZR-pSNRTY2izuNdg@paquier.xyz> <ZR_AESc5tptmpP9t@paquier.xyz> <3365937.1696801735@sss.pgh.pa.us> <ZSPJ0dKz4fdjFs5n@paquier.xyz> <159529.1696868418@sss.pgh.pa.us> <ZSSAvZNDYZgrNvfX@paquier.xyz> <240194.1696907518@sss.pgh.pa.us>
* 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