pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Michael Paquier <michael@paquier.xyz>
To: Nathan Bossart <nathandbossart@gmail.com>
Cc: Andres Freund <andres@anarazel.de>
Cc: Jacob Speidel <jacob@extrahop.com>
Cc: Will Mortensen <will@extrahop.com>
Cc: pgsql-bugs@lists.postgresql.org
Subject: Re: BUG #17973: Reinit of pgstats entry for dropped DB can break autovacuum daemon
Date: Fri, 1 Sep 2023 12:31:09 +0900
Message-ID: <ZPFa/bED0YZc0oE3@paquier.xyz> (raw)
In-Reply-To: <20230901025613.GB3097511@nathanxps13>
References: <20230614213724.gweo666oxqrugm44@awork3.anarazel.de>
	<20230614215744.ddeuii7jcojbp3yv@awork3.anarazel.de>
	<20230614223012.cfyzxyfnt3ggqkt4@awork3.anarazel.de>
	<CAMpnoC5=njD8tLG9q8XQZKi=1SfLehjVPmLJC+pktzGdfZEgoA@mail.gmail.com>
	<CA+pD2MKw6FwU21efw4+kAziFXWB+cnfxiE1824COmp=0x+jwBQ@mail.gmail.com>
	<ZNbRByjoQlUtTkTb@paquier.xyz>
	<20230812004812.4yev47iili57u4hc@awork3.anarazel.de>
	<ZNlxRmI15e1BtCR6@paquier.xyz>
	<ZPE5qXLuMs+/vx9H@paquier.xyz>
	<20230901025613.GB3097511@nathanxps13>

On Thu, Aug 31, 2023 at 07:56:13PM -0700, Nathan Bossart wrote:
> On Fri, Sep 01, 2023 at 10:08:57AM +0900, Michael Paquier wrote:
>> +	/*
>> +	 * Now that we rechecked, we are certain to be connected to a database and
>> +	 * thus can set MyDatabaseId.
>> +	 */
>> +	MyDatabaseId = dboid;
> 
> Perhaps we should expand this comment to make it clear that some code
> depends on this to avoid races with concurrent database drops/renames.

Yeah, this could be a bit more detailed, mentioning the dependency
with the pgstat shutdown callback.  How about appending the following
sentence in a second paragraph, say:
"Setting MyDatabaseId after rechecking the existence of the database
matters for instance with the shutdown callback of the shared
statistics, as pgstat_report_stat() will update database statistics
depending on MyDatabaseId."
--
Michael

Attachments:

  signature.asc (application/pgp-signature, 832B) download

view thread (24+ messages)  latest in thread

Message-ID: <ZPFa/bED0YZc0oE3@paquier.xyz>
Permalink:  ../ZPFa%2FbED0YZc0oE3@paquier.xyz/
Also on:    postgresql.org/message-id/ZPFa/bED0YZc0oE3@paquier.xyz

 · 

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-bugs@postgresql.org
  Cc: michael@paquier.xyz, nathandbossart@gmail.com, andres@anarazel.de, jacob@extrahop.com, will@extrahop.com, pgsql-bugs@lists.postgresql.org
  Subject: Re: BUG #17973: Reinit of pgstats entry for dropped DB can break autovacuum daemon
  In-Reply-To: <ZPFa/bED0YZc0oE3@paquier.xyz>

* 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