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 1s6p47-001y7h-97 for pgsql-hackers@arkaria.postgresql.org; Tue, 14 May 2024 10:07:24 +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 1s6p47-00CR4n-9h for pgsql-hackers@arkaria.postgresql.org; Tue, 14 May 2024 10:07:23 +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 1s6p46-00CR3L-Tg for pgsql-hackers@lists.postgresql.org; Tue, 14 May 2024 10:07:23 +0000 Received: from mail-lf1-x129.google.com ([2a00:1450:4864:20::129]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1s6p41-000Aka-7d for pgsql-hackers@lists.postgresql.org; Tue, 14 May 2024 10:07:22 +0000 Received: by mail-lf1-x129.google.com with SMTP id 2adb3069b0e04-51f99f9e0faso6109838e87.2 for ; Tue, 14 May 2024 03:07:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1715681237; x=1716286037; darn=lists.postgresql.org; h=content-disposition:mime-version:message-id:subject:to:from:date :from:to:cc:subject:date:message-id:reply-to; bh=VHaJSksFckNYpriwepNbSTqpkFo50qkqZz2tshoZg4M=; b=fHjZgLT/jUJvVhk/uRqaEGUt6fpfpDY3ygbHZbJaivf6PfhcTtzyirVvLypZ2A8ub3 9WTWsR7W9rQIYpQ7JlxcCgpKAX3TUpuE2js1sJVfbMebQNE0b5TJCIDz8W3ADXNlMw6V VSBtr+AGnR19MKNuM14MeSF87+jgsO9pQ2Ws/QAdSpZdrYqQRqrsOOso598H+4Vg/SjH b+bfZLbN3SfFqrDxUTro78JrOHBGUpYzISX/+kfz+BaJPQ01GG4lwzZJMFB4I7kM+atC WD5SneOqLHMmI+L7FwDm7sH6zIWtRDjjdXdXBmiXBo3+o2bipm+10dVR2y2NuCpHstxf GpAQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715681237; x=1716286037; h=content-disposition:mime-version:message-id:subject:to:from:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=VHaJSksFckNYpriwepNbSTqpkFo50qkqZz2tshoZg4M=; b=IOvzbXeuka7WeDRA6c9bU/EhcIHZeq2iDZyKv5ZZq0rAMReoXz/QRos2FiGyhjuTHK 0j5JXfwlfz9iuGauvgb51M+jXVj62g77fEnOp0dBbW5M9pgO4EJ/tUboRuNBu0tSUEoY s3+wIg/EA7vGiI/IUdBcru+HT/vSa2LtsfLQYqSlXkE+0UweABULlsK1UEHaNJw5Rm/f xMyOr6oI+RDH+ZIzbxoQHornCuI+MNKPXID8IaJ5dMSeKwiCvc4AVzWSAck0M6/1jRvV /J5qkTN3dnWInuYAP4OvkWSEY9FsB3FMWGRqBLo/sKblZUnPtS8NJ8kq4bXZ3SOHiEpC fm8Q== X-Gm-Message-State: AOJu0YwVtqYlazwYOFLauMOlnixqqW/zXFRFiETjVjSz4QSpfz10Lebp /djwCRgMY9YVxi1THgE1id0tqPCuBIWPcuQaA2OJsNSL728FtJEOWFs1nQ== X-Google-Smtp-Source: AGHT+IENzqtBRUrZc3iZ5YuEb7E8WGWtVDlR3M0dHxy2prfxVYpJu4mmYStGlZ52TzFe6EElz0FHSQ== X-Received: by 2002:ac2:5603:0:b0:51a:f2eb:b4c9 with SMTP id 2adb3069b0e04-5220ff71dcamr7767694e87.1.1715681236535; Tue, 14 May 2024 03:07:16 -0700 (PDT) Received: from ip-10-97-1-34.eu-west-3.compute.internal (ec2-15-236-134-5.eu-west-3.compute.amazonaws.com. [15.236.134.5]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3502baad0absm13212333f8f.69.2024.05.14.03.07.15 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 14 May 2024 03:07:15 -0700 (PDT) Date: Tue, 14 May 2024 10:07:14 +0000 From: Bertrand Drouvot To: pgsql-hackers@lists.postgresql.org Subject: Log details for stats dropped more than once Message-ID: MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="qS8sjQN0UyT4zcze" Content-Disposition: inline List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --qS8sjQN0UyT4zcze Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Hi hackers, While resuming the work on refilenode stats (mentioned in [1] but did not share the patch yet), I realized that my current POC patch is buggy enough to produce things like: 024-05-14 09:51:14.783 UTC [1788714] FATAL: can only drop stats once While the CONTEXT provides the list of dropped stats: 2024-05-14 09:51:14.783 UTC [1788714] CONTEXT: WAL redo at 0/D75F478 for Transaction/ABORT: 2024-05-14 09:51:14.782223+00; dropped stats: 2/16384/27512/0 2/16384/27515/0 2/16384/27516/0 It's not clear which one generates the error (don't pay attention to the actual values, the issue comes from the new refilenode stats that I removed from the output). Attached a tiny patch to report the stat that generates the error. The patch uses errdetail_internal() as the extra details don't seem to be useful to average users. [1]: https://www.postgresql.org/message-id/ZbIdgTjR2QcFJ2mE%40ip-10-97-1-34.eu-west-3.compute.internal Looking forward to your feedback, Regards -- Bertrand Drouvot PostgreSQL Contributors Team RDS Open Source Databases Amazon Web Services: https://aws.amazon.com --qS8sjQN0UyT4zcze Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v1-0001-Log-details-for-stats-dropped-more-than-once.patch" From f296d4092f5e87ed63a323db3f1bc9cfa807e2e8 Mon Sep 17 00:00:00 2001 From: Bertrand Drouvot Date: Tue, 14 May 2024 09:10:50 +0000 Subject: [PATCH v1] Log details for stats dropped more than once Adding errdetail_internal() in pgstat_drop_entry_internal() to display the PgStat_HashKey when the "can only drop stats once" error is reported. --- src/backend/utils/activity/pgstat_shmem.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) 100.0% src/backend/utils/activity/ diff --git a/src/backend/utils/activity/pgstat_shmem.c b/src/backend/utils/activity/pgstat_shmem.c index 91591da395..1308c4439a 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"); + ereport(ERROR, + errmsg("can only drop stats once"), + errdetail_internal("Stats kind=%s dboid=%u objoid=%u.", + pgstat_get_kind_info(shent->key.kind)->name, + shent->key.dboid, shent->key.objoid)); shent->dropped = true; /* release refcount marking entry as not dropped */ -- 2.34.1 --qS8sjQN0UyT4zcze--