Drop "Lock" suffix from LWLock wait event names
authorÁlvaro Herrera <[email protected]>
Tue, 3 Dec 2024 14:50:03 +0000 (15:50 +0100)
committerÁlvaro Herrera <[email protected]>
Tue, 3 Dec 2024 14:50:03 +0000 (15:50 +0100)
Commit da952b415f44 unintentially reverted the SQL-visible part of
commit 14a910109126, which breaks queries joining pg_wait_events with
pg_stat_acivity.  Remove the suffix again.

Back to 17.

Reported-by: Christophe Courtois <[email protected]>
Author: Bertrand Drouvot <[email protected]>
Discussion: https://postgr.es/m/18728-450924477056a339%40postgresql.org
Discussion: https://postgr.es/m/[email protected]

src/backend/storage/lmgr/generate-lwlocknames.pl
src/backend/storage/lmgr/lwlock.c

index eaddd9d3b976f4f4a1a6d0f256d4fdb2eedcba29..4eee6b47f1533a6cf98bb795475ba67c717eae4a 100644 (file)
@@ -107,6 +107,7 @@ while (<$lwlocklist>)
    $lastlockidx = $lockidx;
    $continue = ",\n";
 
+   # Add a "Lock" suffix to each lock name, as the C code depends on that
    print $h "#define ${lockname}Lock (&MainLWLockArray[$lockidx].lock)\n";
 }
 
index 4e1a4b1ef66da5581344ace4fe61bdac957f23cd..5df62fafbfbae13d0be3d2f465cc624aae96f9fc 100644 (file)
@@ -111,7 +111,7 @@ StaticAssertDecl(LW_VAL_EXCLUSIVE > (uint32) MAX_BACKENDS,
 /*
  * There are three sorts of LWLock "tranches":
  *
- * 1. The individually-named locks defined in lwlocknames.h each have their
+ * 1. The individually-named locks defined in lwlocklist.h each have their
  * own tranche.  We absorb the names of these tranches from there into
  * BuiltinTrancheNames here.
  *
@@ -127,7 +127,7 @@ StaticAssertDecl(LW_VAL_EXCLUSIVE > (uint32) MAX_BACKENDS,
  * ... and do not forget to update the documentation's list of wait events.
  */
 static const char *const BuiltinTrancheNames[] = {
-#define PG_LWLOCK(id, lockname) [id] = CppAsString(lockname) "Lock",
+#define PG_LWLOCK(id, lockname) [id] = CppAsString(lockname),
 #include "storage/lwlocklist.h"
 #undef PG_LWLOCK
    [LWTRANCHE_XACT_BUFFER] = "XactBuffer",