Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1qbusY-00DMcb-Bn for pgsql-bugs@arkaria.postgresql.org; Fri, 01 Sep 2023 03:31:27 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1qbusW-00BtzY-Bq for pgsql-bugs@arkaria.postgresql.org; Fri, 01 Sep 2023 03:31:24 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1qbusU-00BtzK-Qf for pgsql-bugs@lists.postgresql.org; Fri, 01 Sep 2023 03:31:23 +0000 Received: from out5-smtp.messagingengine.com ([66.111.4.29]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1qbusR-0025AX-Bu for pgsql-bugs@lists.postgresql.org; Fri, 01 Sep 2023 03:31:21 +0000 Received: from compute6.internal (compute6.nyi.internal [10.202.2.47]) by mailout.nyi.internal (Postfix) with ESMTP id 1A06B5C0046; Thu, 31 Aug 2023 23:31:18 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute6.internal (MEProxy); Thu, 31 Aug 2023 23:31:18 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=paquier.xyz; h= cc:cc:content-type:content-type:date:date:from:from:in-reply-to :in-reply-to:message-id:mime-version:references:reply-to:sender :subject:subject:to:to; s=fm1; t=1693539078; x=1693625478; bh=fo niJ3kVWK0EXrHlNZ4xC/2wuClNbElL/OwrPykzdIs=; b=BEU8o7JJCCKYaX99EH /rd2gljsZ91X0Dvc3EMzzveq9PlzZ7KRMEwqRsy7pUCPhFTNTlT2Nkp2z/5yy5ZT 0zLASfuMb4dnM8HA9fnZMDsU0GCoOw8BliEZJobiPeQrLkC1qUva+ieEI71/UypZ ozuiO1mL6TGVuQTvxijbhuRdgUyu+u70/O2xFSjEphsq+ADQ3D6kjppK/KbKcU5e ACMGb0a0casY7QqbK+v4BjU1vRpLe/dE93X7f2OxDH/6K4JawxNY//RLVO77j37m WJ9r/X2QNdcDJtAQRhl/jSJ72QpML9sRY2kZ5G6vzy6wtWvpQJJlx1PaPsWxcJgG 9Pwg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-type:content-type:date:date :feedback-id:feedback-id:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:sender:subject :subject:to:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm1; t=1693539078; x=1693625478; bh=foniJ3kVWK0EX rHlNZ4xC/2wuClNbElL/OwrPykzdIs=; b=obCOOBnNjNXQceULxVxXrcKMkqeec 6FYt6/MBLQjLj3kzgFyRZyTqRUCqEyO2eAfjxmdYPXLyL7dFScsRv+JnLvZ9Tcqq pYfPphR8CD9O4OCZ6//4lowrca/4/fSWKYlbdFpNzVBbDRKlCsCyoAP0K2qA2cfz doDBhALNA2gq5xbydj7UT3W1dytQBu7+SlbiXpcjMYkMCBDAUlMsGQkbaEwpSKb3 AAFqGQdcfynHz6HOCcAiVaJM/ogd+fElgmxk+9JSpumOWr36Rh3kZ5NH/pqFFLuT K6iKDpKXgSPrWO71KjK9wji9nLVxklVDGZ4hnCwm+ByQky3DRVokq3TLQ== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedviedrudeguddgjedtucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne gfrhhlucfvnfffucdljedtmdenucfjughrpeffhffvvefukfhfgggtuggjsehgtderredt tddvnecuhfhrohhmpefoihgthhgrvghlucfrrghquhhivghruceomhhitghhrggvlhesph grqhhuihgvrhdrgiihiieqnecuggftrfgrthhtvghrnhepteelieefudffhffhtdetleeg geegfffhkeeuveetiefgudduvedutefggeeivdejnecuvehluhhsthgvrhfuihiivgeptd enucfrrghrrghmpehmrghilhhfrhhomhepmhhitghhrggvlhesphgrqhhuihgvrhdrgiih ii X-ME-Proxy: Feedback-ID: i0fe9450f:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Thu, 31 Aug 2023 23:31:15 -0400 (EDT) Date: Fri, 1 Sep 2023 12:31:09 +0900 From: Michael Paquier To: Nathan Bossart Cc: Andres Freund , Jacob Speidel , Will Mortensen , pgsql-bugs@lists.postgresql.org Subject: Re: BUG #17973: Reinit of pgstats entry for dropped DB can break autovacuum daemon Message-ID: References: <20230614213724.gweo666oxqrugm44@awork3.anarazel.de> <20230614215744.ddeuii7jcojbp3yv@awork3.anarazel.de> <20230614223012.cfyzxyfnt3ggqkt4@awork3.anarazel.de> <20230812004812.4yev47iili57u4hc@awork3.anarazel.de> <20230901025613.GB3097511@nathanxps13> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="YplmPOTxze9V1Pff" Content-Disposition: inline In-Reply-To: <20230901025613.GB3097511@nathanxps13> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --YplmPOTxze9V1Pff Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable 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 =3D dboid; >=20 > 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 --YplmPOTxze9V1Pff Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEG72nH6vTowiyblFKnvQgOdbyQH0FAmTxWv0ACgkQnvQgOdby QH1Jrw//T8eC5A3wWkM3e4pdu7KiE93mgnFPt1fYAms2VY3aDeFkpzHySjzpweIb brAB9dnUL3Qw5MOzXr0VOaxWlp69/Nb7/6aMCebzHBcgjGeEHApOZJBA5JdJeKDe U7+DbLahKx0G/PYPT7kq1oqlylrSmXb5SdZP/HX4xFVaQhguhinq/ThtiYRBXX1E dTOUcqcFB2vMF5OWsCL4u01SolPKoUYM53LDpYa+i7siB7nQU1L44LKerxzRSU3y f3v/BYywFkFF2cj+guPYlvGM88s0PzQTpxku/DPAoTF/maCvjzMP2TO7NsMsxuh+ 6NGr+qWreWJSKnRChOUoWC68NiPUs2OvRm3nA3NVQTVnSeoUi3Sgv3H9g/GhYA67 LGY6+BMnpw2Xb3P11w4iuZ+fuKeLbtI/Fne4IooNectx/BcHtazOTf1E+JVAG47K uLAyiG26o7m5ptN4M3sHRl0Xqd4lnjmgB44HO7+89XWIvXLOpLeuT1OwgkEw1f3S BcE7BtG3ElhKBSemAgHjd9OJ/Ki1rm7ESrp6PMNbDcDprfFfeht674ZL5+IDp/9n lSFRSBHc6oTybsDVg+0gozXFcrEV0IiqSk3mDuB3pc77ucY+vJSZ8J4CxewQ12ii 5iHmsf5+DXe2PziCrVlcWjRE2uXS8ITv2RX/4CZmFxIAPgKiruI= =Wu4p -----END PGP SIGNATURE----- --YplmPOTxze9V1Pff--