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 1s2ye7-0081H1-FF for pgsql-bugs@arkaria.postgresql.org; Fri, 03 May 2024 19:32:39 +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 1s2ye4-00BYqB-9P for pgsql-bugs@arkaria.postgresql.org; Fri, 03 May 2024 19:32:37 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1s2ye4-00BYq2-15 for pgsql-bugs@lists.postgresql.org; Fri, 03 May 2024 19:32:36 +0000 Received: from sss.pgh.pa.us ([68.162.161.243]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1s2ydx-001OEa-TY for pgsql-bugs@lists.postgresql.org; Fri, 03 May 2024 19:32:36 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.15.2/8.15.2) with ESMTP id 443JWQ5V2730849; Fri, 3 May 2024 15:32:26 -0400 From: Tom Lane To: Floris Van Nee cc: "pgsql-bugs@lists.postgresql.org" , Andres Freund Subject: Re: error "can only drop stats once" brings down database In-reply-to: <8e5cb534706a4f43bd74405c8fd91437@Optiver.com> References: <215498.1708454947@sss.pgh.pa.us> <8e5cb534706a4f43bd74405c8fd91437@Optiver.com> Comments: In-reply-to Floris Van Nee message dated "Fri, 03 May 2024 18:10:05 -0000" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <2730847.1714764746.1@sss.pgh.pa.us> Date: Fri, 03 May 2024 15:32:26 -0400 Message-ID: <2730848.1714764746@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Floris Van Nee writes: >> Hmm. This must be coming from pgstat_drop_entry_internal. >> I suspect the correct fix is in pgstat_drop_entry, along the lines of >> >> - if (shent) >> + if (shent && !shent->dropped) >> >> but it's not clear to me how the already-dropped case ought to affect the >> function's bool result. Also, how are we getting into a concurrent-drop >> situation in recovery? > Anyone has further thoughts on this? This still happens occasionally. I was expecting Andres to comment on it eventually. I don't know that code well enough to want to modify it on my own authority, especially not just before a release. One thing that would be safe enough and perhaps useful is to modify the "can only drop stats once" message to provide a little more detail, like the hash key of the problematic entry. That might help us understand what's triggering this. The OIDs would be opaque perhaps, but the PgStat_Kind value seems useful to know. regards, tom lane