Skip to content

Commit 5ffbbcf

Browse files
committed
Drop "Lock" suffix from LWLock wait event names
Commit da952b4 unintentially reverted the SQL-visible part of commit 14a9101, which breaks queries joining pg_wait_events with pg_stat_acivity. Remove the suffix again. Backpatch to 17. Reported-by: Christophe Courtois <christophe.courtois@dalibo.com> Author: Bertrand Drouvot <bertranddrouvot.pg@gmail.com> Discussion: https://postgr.es/m/18728-450924477056a339%40postgresql.org Discussion: https://postgr.es/m/Z01w1+LihtRiS0Te@ip-10-97-1-34.eu-west-3.compute.internal
1 parent 7a35052 commit 5ffbbcf

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

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

+1
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,7 @@
107107
$lastlockidx = $lockidx;
108108
$continue = ",\n";
109109

110+
# Add a "Lock" suffix to each lock name, as the C code depends on that
110111
print $h "#define ${lockname}Lock (&MainLWLockArray[$lockidx].lock)\n";
111112
}
112113

src/backend/storage/lmgr/lwlock.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ StaticAssertDecl(LW_VAL_EXCLUSIVE > (uint32) MAX_BACKENDS,
111111
/*
112112
* There are three sorts of LWLock "tranches":
113113
*
114-
* 1. The individually-named locks defined in lwlocknames.h each have their
114+
* 1. The individually-named locks defined in lwlocklist.h each have their
115115
* own tranche. We absorb the names of these tranches from there into
116116
* BuiltinTrancheNames here.
117117
*
@@ -127,7 +127,7 @@ StaticAssertDecl(LW_VAL_EXCLUSIVE > (uint32) MAX_BACKENDS,
127127
* ... and do not forget to update the documentation's list of wait events.
128128
*/
129129
static const char *const BuiltinTrancheNames[] = {
130-
#define PG_LWLOCK(id, lockname) [id] = CppAsString(lockname) "Lock",
130+
#define PG_LWLOCK(id, lockname) [id] = CppAsString(lockname),
131131
#include "storage/lwlocklist.h"
132132
#undef PG_LWLOCK
133133
[LWTRANCHE_XACT_BUFFER] = "XactBuffer",

0 commit comments

Comments
 (0)