From: Michael Paquier <michael@paquier.xyz>
To: Floris Van Nee <florisvannee@optiver.com>
Cc: Andres Freund <andres@anarazel.de>
Cc: Tom Lane <tgl@sss.pgh.pa.us>
Cc: pgsql-bugs@lists.postgresql.org <pgsql-bugs@lists.postgresql.org>
Cc: Bertrand Drouvot <bertranddrouvot.pg@gmail.com>
Subject: Re: error "can only drop stats once" brings down database
Date: Thu, 6 Jun 2024 13:44:26 +0900
Message-ID: <ZmE-qm8d9kfDfnMy@paquier.xyz> (raw)
In-Reply-To: <68430b1b76d44558b7b07ae8c69151f6@Optiver.com>
References: <b14ae28029f64757bb64613be2549a74@Optiver.com>
<215498.1708454947@sss.pgh.pa.us>
<8e5cb534706a4f43bd74405c8fd91437@Optiver.com>
<20240505160915.6boysum4f34siqct@awork3.anarazel.de>
<20240505223546.6yvjzgqifuoiii3e@awork3.anarazel.de>
<47ca6fcc687e408287871f7eaaaf3c3b@Optiver.com>
<Zl6gQNSeWoBdijxZ@paquier.xyz>
<68430b1b76d44558b7b07ae8c69151f6@Optiver.com>
On Wed, Jun 05, 2024 at 10:31:04AM +0000, Floris Van Nee wrote:
> This patch would help in getting more info about this specific issue
> if it reoccurs, but in that case it's only helpful if it's
> backpatched.
> Agree the refcount addition makes sense.
Adding Bertrand in CC as he was similarly playing with this area.
What would both of you think about the attached. This is a mix of
what's been proposed on the two threads, with the addition of the
refcount.
--
Michael
Attachments:pgstat-drop-debug.patch (text/x-diff, 747B) downloaddiff --git a/src/backend/utils/activity/pgstat_shmem.c b/src/backend/utils/activity/pgstat_shmem.cindex 4a4b69891d..fb79c5e771 100644--- a/src/backend/utils/activity/pgstat_shmem.c+++ b/src/backend/utils/activity/pgstat_shmem.c@@ -785,7 +785,11 @@ pgstat_drop_entry_internal(PgStatShared_HashEntry *shent,
* backends to release their references.
*/
if (shent->dropped)
- elog(ERROR, "can only drop stats once");+ elog(ERROR,+ "trying to drop stats entry already dropped: kind=%s dboid=%u objoid=%u refcount=%u",+ pgstat_get_kind_info(shent->key.kind)->name,+ shent->key.dboid, shent->key.objoid,+ pg_atomic_read_u32(&shent->refcount));
shent->dropped = true;
/* release refcount marking entry as not dropped */
signature.asc (application/pgp-signature, 832B) download
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, florisvannee@optiver.com, andres@anarazel.de, tgl@sss.pgh.pa.us, pgsql-bugs@lists.postgresql.org, bertranddrouvot.pg@gmail.com
Subject: Re: error "can only drop stats once" brings down database
In-Reply-To: <ZmE-qm8d9kfDfnMy@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