Commit 14a91010 authored by Tom Lane's avatar Tom Lane

Drop the redundant "Lock" suffix from LWLock wait event names.

This was mostly confusing, especially since some wait events in
this class had the suffix and some did not.

While at it, stop exposing MainLWLockNames[] as a globally visible
name; any code using that directly is almost certainly wrong, as
its name has been misleading for some time.
(GetLWLockIdentifier() is what to use instead.)

Discussion: https://postgr.es/m/28683.1589405363@sss.pgh.pa.us
parent 80484049
...@@ -1750,31 +1750,31 @@ postgres 27093 0.0 0.0 30096 2752 ? Ss 11:34 0:00 postgres: ser ...@@ -1750,31 +1750,31 @@ postgres 27093 0.0 0.0 30096 2752 ? Ss 11:34 0:00 postgres: ser
<tbody> <tbody>
<row> <row>
<entry><literal>AddinShmemInitLock</literal></entry> <entry><literal>AddinShmemInit</literal></entry>
<entry>Waiting to manage an extension's space allocation in shared <entry>Waiting to manage an extension's space allocation in shared
memory.</entry> memory.</entry>
</row> </row>
<row> <row>
<entry><literal>AutoFileLock</literal></entry> <entry><literal>AutoFile</literal></entry>
<entry>Waiting to update the <filename>postgresql.auto.conf</filename> <entry>Waiting to update the <filename>postgresql.auto.conf</filename>
file.</entry> file.</entry>
</row> </row>
<row> <row>
<entry><literal>AutovacuumLock</literal></entry> <entry><literal>Autovacuum</literal></entry>
<entry>Waiting to read or update the current state of autovacuum <entry>Waiting to read or update the current state of autovacuum
workers.</entry> workers.</entry>
</row> </row>
<row> <row>
<entry><literal>AutovacuumScheduleLock</literal></entry> <entry><literal>AutovacuumSchedule</literal></entry>
<entry>Waiting to ensure that a table selected for autovacuum <entry>Waiting to ensure that a table selected for autovacuum
still needs vacuuming.</entry> still needs vacuuming.</entry>
</row> </row>
<row> <row>
<entry><literal>BackgroundWorkerLock</literal></entry> <entry><literal>BackgroundWorker</literal></entry>
<entry>Waiting to read or update background worker state.</entry> <entry>Waiting to read or update background worker state.</entry>
</row> </row>
<row> <row>
<entry><literal>BtreeVacuumLock</literal></entry> <entry><literal>BtreeVacuum</literal></entry>
<entry>Waiting to read or update vacuum-related information for a <entry>Waiting to read or update vacuum-related information for a
B-tree index.</entry> B-tree index.</entry>
</row> </row>
...@@ -1792,15 +1792,15 @@ postgres 27093 0.0 0.0 30096 2752 ? Ss 11:34 0:00 postgres: ser ...@@ -1792,15 +1792,15 @@ postgres 27093 0.0 0.0 30096 2752 ? Ss 11:34 0:00 postgres: ser
pool.</entry> pool.</entry>
</row> </row>
<row> <row>
<entry><literal>CheckpointLock</literal></entry> <entry><literal>Checkpoint</literal></entry>
<entry>Waiting to begin a checkpoint.</entry> <entry>Waiting to begin a checkpoint.</entry>
</row> </row>
<row> <row>
<entry><literal>CheckpointerCommLock</literal></entry> <entry><literal>CheckpointerComm</literal></entry>
<entry>Waiting to manage fsync requests.</entry> <entry>Waiting to manage fsync requests.</entry>
</row> </row>
<row> <row>
<entry><literal>CommitTsLock</literal></entry> <entry><literal>CommitTs</literal></entry>
<entry>Waiting to read or update the last value set for a <entry>Waiting to read or update the last value set for a
transaction commit timestamp.</entry> transaction commit timestamp.</entry>
</row> </row>
...@@ -1809,16 +1809,16 @@ postgres 27093 0.0 0.0 30096 2752 ? Ss 11:34 0:00 postgres: ser ...@@ -1809,16 +1809,16 @@ postgres 27093 0.0 0.0 30096 2752 ? Ss 11:34 0:00 postgres: ser
<entry>Waiting for I/O on a commit timestamp SLRU buffer.</entry> <entry>Waiting for I/O on a commit timestamp SLRU buffer.</entry>
</row> </row>
<row> <row>
<entry><literal>CommitTsSLRULock</literal></entry> <entry><literal>CommitTsSLRU</literal></entry>
<entry>Waiting to access the commit timestamp SLRU cache.</entry> <entry>Waiting to access the commit timestamp SLRU cache.</entry>
</row> </row>
<row> <row>
<entry><literal>ControlFileLock</literal></entry> <entry><literal>ControlFile</literal></entry>
<entry>Waiting to read or update the <filename>pg_control</filename> <entry>Waiting to read or update the <filename>pg_control</filename>
file or create a new WAL file.</entry> file or create a new WAL file.</entry>
</row> </row>
<row> <row>
<entry><literal>DynamicSharedMemoryControlLock</literal></entry> <entry><literal>DynamicSharedMemoryControl</literal></entry>
<entry>Waiting to read or update dynamic shared memory allocation <entry>Waiting to read or update dynamic shared memory allocation
information.</entry> information.</entry>
</row> </row>
...@@ -1833,12 +1833,12 @@ postgres 27093 0.0 0.0 30096 2752 ? Ss 11:34 0:00 postgres: ser ...@@ -1833,12 +1833,12 @@ postgres 27093 0.0 0.0 30096 2752 ? Ss 11:34 0:00 postgres: ser
about <quote>heavyweight</quote> locks.</entry> about <quote>heavyweight</quote> locks.</entry>
</row> </row>
<row> <row>
<entry><literal>LogicalRepWorkerLock</literal></entry> <entry><literal>LogicalRepWorker</literal></entry>
<entry>Waiting to read or update the state of logical replication <entry>Waiting to read or update the state of logical replication
workers.</entry> workers.</entry>
</row> </row>
<row> <row>
<entry><literal>MultiXactGenLock</literal></entry> <entry><literal>MultiXactGen</literal></entry>
<entry>Waiting to read or update shared multixact state.</entry> <entry>Waiting to read or update shared multixact state.</entry>
</row> </row>
<row> <row>
...@@ -1846,7 +1846,7 @@ postgres 27093 0.0 0.0 30096 2752 ? Ss 11:34 0:00 postgres: ser ...@@ -1846,7 +1846,7 @@ postgres 27093 0.0 0.0 30096 2752 ? Ss 11:34 0:00 postgres: ser
<entry>Waiting for I/O on a multixact member SLRU buffer.</entry> <entry>Waiting for I/O on a multixact member SLRU buffer.</entry>
</row> </row>
<row> <row>
<entry><literal>MultiXactMemberSLRULock</literal></entry> <entry><literal>MultiXactMemberSLRU</literal></entry>
<entry>Waiting to access the multixact member SLRU cache.</entry> <entry>Waiting to access the multixact member SLRU cache.</entry>
</row> </row>
<row> <row>
...@@ -1854,11 +1854,11 @@ postgres 27093 0.0 0.0 30096 2752 ? Ss 11:34 0:00 postgres: ser ...@@ -1854,11 +1854,11 @@ postgres 27093 0.0 0.0 30096 2752 ? Ss 11:34 0:00 postgres: ser
<entry>Waiting for I/O on a multixact offset SLRU buffer.</entry> <entry>Waiting for I/O on a multixact offset SLRU buffer.</entry>
</row> </row>
<row> <row>
<entry><literal>MultiXactOffsetSLRULock</literal></entry> <entry><literal>MultiXactOffsetSLRU</literal></entry>
<entry>Waiting to access the multixact offset SLRU cache.</entry> <entry>Waiting to access the multixact offset SLRU cache.</entry>
</row> </row>
<row> <row>
<entry><literal>MultiXactTruncationLock</literal></entry> <entry><literal>MultiXactTruncation</literal></entry>
<entry>Waiting to read or truncate multixact information.</entry> <entry>Waiting to read or truncate multixact information.</entry>
</row> </row>
<row> <row>
...@@ -1867,20 +1867,20 @@ postgres 27093 0.0 0.0 30096 2752 ? Ss 11:34 0:00 postgres: ser ...@@ -1867,20 +1867,20 @@ postgres 27093 0.0 0.0 30096 2752 ? Ss 11:34 0:00 postgres: ser
buffer.</entry> buffer.</entry>
</row> </row>
<row> <row>
<entry><literal>NotifyQueueLock</literal></entry> <entry><literal>NotifyQueue</literal></entry>
<entry>Waiting to read or update <command>NOTIFY</command> messages.</entry> <entry>Waiting to read or update <command>NOTIFY</command> messages.</entry>
</row> </row>
<row> <row>
<entry><literal>NotifySLRULock</literal></entry> <entry><literal>NotifySLRU</literal></entry>
<entry>Waiting to access the <command>NOTIFY</command> message SLRU <entry>Waiting to access the <command>NOTIFY</command> message SLRU
cache.</entry> cache.</entry>
</row> </row>
<row> <row>
<entry><literal>OidGenLock</literal></entry> <entry><literal>OidGen</literal></entry>
<entry>Waiting to allocate a new OID.</entry> <entry>Waiting to allocate a new OID.</entry>
</row> </row>
<row> <row>
<entry><literal>OldSnapshotTimeMapLock</literal></entry> <entry><literal>OldSnapshotTimeMap</literal></entry>
<entry>Waiting to read or update old snapshot control information.</entry> <entry>Waiting to read or update old snapshot control information.</entry>
</row> </row>
<row> <row>
...@@ -1922,24 +1922,24 @@ postgres 27093 0.0 0.0 30096 2752 ? Ss 11:34 0:00 postgres: ser ...@@ -1922,24 +1922,24 @@ postgres 27093 0.0 0.0 30096 2752 ? Ss 11:34 0:00 postgres: ser
serializable transactions.</entry> serializable transactions.</entry>
</row> </row>
<row> <row>
<entry><literal>ProcArrayLock</literal></entry> <entry><literal>ProcArray</literal></entry>
<entry>Waiting to access the shared per-process data structures <entry>Waiting to access the shared per-process data structures
(typically, to get a snapshot or report a session's transaction (typically, to get a snapshot or report a session's transaction
ID).</entry> ID).</entry>
</row> </row>
<row> <row>
<entry><literal>RelationMappingLock</literal></entry> <entry><literal>RelationMapping</literal></entry>
<entry>Waiting to read or update <entry>Waiting to read or update
a <filename>pg_filenode.map</filename> file (used to track the a <filename>pg_filenode.map</filename> file (used to track the
filenode assignments of certain system catalogs).</entry> filenode assignments of certain system catalogs).</entry>
</row> </row>
<row> <row>
<entry><literal>RelCacheInitLock</literal></entry> <entry><literal>RelCacheInit</literal></entry>
<entry>Waiting to read or update a <filename>pg_internal.init</filename> <entry>Waiting to read or update a <filename>pg_internal.init</filename>
relation cache initialization file.</entry> relation cache initialization file.</entry>
</row> </row>
<row> <row>
<entry><literal>ReplicationOriginLock</literal></entry> <entry><literal>ReplicationOrigin</literal></entry>
<entry>Waiting to create, drop or use a replication origin.</entry> <entry>Waiting to create, drop or use a replication origin.</entry>
</row> </row>
<row> <row>
...@@ -1948,11 +1948,11 @@ postgres 27093 0.0 0.0 30096 2752 ? Ss 11:34 0:00 postgres: ser ...@@ -1948,11 +1948,11 @@ postgres 27093 0.0 0.0 30096 2752 ? Ss 11:34 0:00 postgres: ser
origin.</entry> origin.</entry>
</row> </row>
<row> <row>
<entry><literal>ReplicationSlotAllocationLock</literal></entry> <entry><literal>ReplicationSlotAllocation</literal></entry>
<entry>Waiting to allocate or free a replication slot.</entry> <entry>Waiting to allocate or free a replication slot.</entry>
</row> </row>
<row> <row>
<entry><literal>ReplicationSlotControlLock</literal></entry> <entry><literal>ReplicationSlotControl</literal></entry>
<entry>Waiting to read or update replication slot state.</entry> <entry>Waiting to read or update replication slot state.</entry>
</row> </row>
<row> <row>
...@@ -1965,22 +1965,22 @@ postgres 27093 0.0 0.0 30096 2752 ? Ss 11:34 0:00 postgres: ser ...@@ -1965,22 +1965,22 @@ postgres 27093 0.0 0.0 30096 2752 ? Ss 11:34 0:00 postgres: ser
buffer.</entry> buffer.</entry>
</row> </row>
<row> <row>
<entry><literal>SerializableFinishedListLock</literal></entry> <entry><literal>SerializableFinishedList</literal></entry>
<entry>Waiting to access the list of finished serializable <entry>Waiting to access the list of finished serializable
transactions.</entry> transactions.</entry>
</row> </row>
<row> <row>
<entry><literal>SerializablePredicateListLock</literal></entry> <entry><literal>SerializablePredicateList</literal></entry>
<entry>Waiting to access the list of predicate locks held by <entry>Waiting to access the list of predicate locks held by
serializable transactions.</entry> serializable transactions.</entry>
</row> </row>
<row> <row>
<entry><literal>SerializableXactHashLock</literal></entry> <entry><literal>SerializableXactHash</literal></entry>
<entry>Waiting to read or update information about serializable <entry>Waiting to read or update information about serializable
transactions.</entry> transactions.</entry>
</row> </row>
<row> <row>
<entry><literal>SerialSLRULock</literal></entry> <entry><literal>SerialSLRU</literal></entry>
<entry>Waiting to access the serializable transaction conflict SLRU <entry>Waiting to access the serializable transaction conflict SLRU
cache.</entry> cache.</entry>
</row> </row>
...@@ -1995,16 +1995,16 @@ postgres 27093 0.0 0.0 30096 2752 ? Ss 11:34 0:00 postgres: ser ...@@ -1995,16 +1995,16 @@ postgres 27093 0.0 0.0 30096 2752 ? Ss 11:34 0:00 postgres: ser
query.</entry> query.</entry>
</row> </row>
<row> <row>
<entry><literal>ShmemIndexLock</literal></entry> <entry><literal>ShmemIndex</literal></entry>
<entry>Waiting to find or allocate space in shared memory.</entry> <entry>Waiting to find or allocate space in shared memory.</entry>
</row> </row>
<row> <row>
<entry><literal>SInvalReadLock</literal></entry> <entry><literal>SInvalRead</literal></entry>
<entry>Waiting to retrieve messages from the shared catalog invalidation <entry>Waiting to retrieve messages from the shared catalog invalidation
queue.</entry> queue.</entry>
</row> </row>
<row> <row>
<entry><literal>SInvalWriteLock</literal></entry> <entry><literal>SInvalWrite</literal></entry>
<entry>Waiting to add a message to the shared catalog invalidation <entry>Waiting to add a message to the shared catalog invalidation
queue.</entry> queue.</entry>
</row> </row>
...@@ -2013,29 +2013,29 @@ postgres 27093 0.0 0.0 30096 2752 ? Ss 11:34 0:00 postgres: ser ...@@ -2013,29 +2013,29 @@ postgres 27093 0.0 0.0 30096 2752 ? Ss 11:34 0:00 postgres: ser
<entry>Waiting for I/O on a sub-transaction SLRU buffer.</entry> <entry>Waiting for I/O on a sub-transaction SLRU buffer.</entry>
</row> </row>
<row> <row>
<entry><literal>SubtransSLRULock</literal></entry> <entry><literal>SubtransSLRU</literal></entry>
<entry>Waiting to access the sub-transaction SLRU cache.</entry> <entry>Waiting to access the sub-transaction SLRU cache.</entry>
</row> </row>
<row> <row>
<entry><literal>SyncRepLock</literal></entry> <entry><literal>SyncRep</literal></entry>
<entry>Waiting to read or update information about the state of <entry>Waiting to read or update information about the state of
synchronous replication.</entry> synchronous replication.</entry>
</row> </row>
<row> <row>
<entry><literal>SyncScanLock</literal></entry> <entry><literal>SyncScan</literal></entry>
<entry>Waiting to select the starting location of a synchronized table <entry>Waiting to select the starting location of a synchronized table
scan.</entry> scan.</entry>
</row> </row>
<row> <row>
<entry><literal>TablespaceCreateLock</literal></entry> <entry><literal>TablespaceCreate</literal></entry>
<entry>Waiting to create or drop a tablespace.</entry> <entry>Waiting to create or drop a tablespace.</entry>
</row> </row>
<row> <row>
<entry><literal>TwoPhaseStateLock</literal></entry> <entry><literal>TwoPhaseState</literal></entry>
<entry>Waiting to read or update the state of prepared transactions.</entry> <entry>Waiting to read or update the state of prepared transactions.</entry>
</row> </row>
<row> <row>
<entry><literal>WALBufMappingLock</literal></entry> <entry><literal>WALBufMapping</literal></entry>
<entry>Waiting to replace a page in WAL buffers.</entry> <entry>Waiting to replace a page in WAL buffers.</entry>
</row> </row>
<row> <row>
...@@ -2043,7 +2043,7 @@ postgres 27093 0.0 0.0 30096 2752 ? Ss 11:34 0:00 postgres: ser ...@@ -2043,7 +2043,7 @@ postgres 27093 0.0 0.0 30096 2752 ? Ss 11:34 0:00 postgres: ser
<entry>Waiting to insert WAL data into a memory buffer.</entry> <entry>Waiting to insert WAL data into a memory buffer.</entry>
</row> </row>
<row> <row>
<entry><literal>WALWriteLock</literal></entry> <entry><literal>WALWrite</literal></entry>
<entry>Waiting for WAL buffers to be written to disk.</entry> <entry>Waiting for WAL buffers to be written to disk.</entry>
</row> </row>
<row> <row>
...@@ -2051,16 +2051,16 @@ postgres 27093 0.0 0.0 30096 2752 ? Ss 11:34 0:00 postgres: ser ...@@ -2051,16 +2051,16 @@ postgres 27093 0.0 0.0 30096 2752 ? Ss 11:34 0:00 postgres: ser
<entry>Waiting for I/O on a transaction status SLRU buffer.</entry> <entry>Waiting for I/O on a transaction status SLRU buffer.</entry>
</row> </row>
<row> <row>
<entry><literal>XactSLRULock</literal></entry> <entry><literal>XactSLRU</literal></entry>
<entry>Waiting to access the transaction status SLRU cache.</entry> <entry>Waiting to access the transaction status SLRU cache.</entry>
</row> </row>
<row> <row>
<entry><literal>XactTruncationLock</literal></entry> <entry><literal>XactTruncation</literal></entry>
<entry>Waiting to execute <function>pg_xact_status</function> or update <entry>Waiting to execute <function>pg_xact_status</function> or update
the oldest transaction ID available to it.</entry> the oldest transaction ID available to it.</entry>
</row> </row>
<row> <row>
<entry><literal>XidGenLock</literal></entry> <entry><literal>XidGen</literal></entry>
<entry>Waiting to allocate a new transaction ID.</entry> <entry>Waiting to allocate a new transaction ID.</entry>
</row> </row>
</tbody> </tbody>
......
...@@ -23,7 +23,7 @@ print $h $autogen; ...@@ -23,7 +23,7 @@ print $h $autogen;
print $h "/* there is deliberately not an #ifndef LWLOCKNAMES_H here */\n\n"; print $h "/* there is deliberately not an #ifndef LWLOCKNAMES_H here */\n\n";
print $c $autogen, "\n"; print $c $autogen, "\n";
print $c "const char *const MainLWLockNames[] = {"; print $c "const char *const IndividualLWLockNames[] = {";
while (<$lwlocknames>) while (<$lwlocknames>)
{ {
...@@ -38,6 +38,10 @@ while (<$lwlocknames>) ...@@ -38,6 +38,10 @@ while (<$lwlocknames>)
(my $lockname, my $lockidx) = ($1, $2); (my $lockname, my $lockidx) = ($1, $2);
my $trimmedlockname = $lockname;
$trimmedlockname =~ s/Lock$//;
die "lock names must end with 'Lock'" if $trimmedlockname eq $lockname;
die "lwlocknames.txt not in order" if $lockidx < $lastlockidx; die "lwlocknames.txt not in order" if $lockidx < $lastlockidx;
die "lwlocknames.txt has duplicates" if $lockidx == $lastlockidx; die "lwlocknames.txt has duplicates" if $lockidx == $lastlockidx;
...@@ -47,7 +51,7 @@ while (<$lwlocknames>) ...@@ -47,7 +51,7 @@ while (<$lwlocknames>)
printf $c "%s \"<unassigned:%d>\"", $continue, $lastlockidx; printf $c "%s \"<unassigned:%d>\"", $continue, $lastlockidx;
$continue = ",\n"; $continue = ",\n";
} }
printf $c "%s \"%s\"", $continue, $lockname; printf $c "%s \"%s\"", $continue, $trimmedlockname;
$lastlockidx = $lockidx; $lastlockidx = $lockidx;
$continue = ",\n"; $continue = ",\n";
......
...@@ -111,7 +111,7 @@ extern slock_t *ShmemLock; ...@@ -111,7 +111,7 @@ extern slock_t *ShmemLock;
* There are three sorts of LWLock "tranches": * 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 lwlocknames.h each have their
* own tranche. The names of these tranches appear in MainLWLockNames[] * own tranche. The names of these tranches appear in IndividualLWLockNames[]
* in lwlocknames.c. * in lwlocknames.c.
* *
* 2. There are some predefined tranches for built-in groups of locks. * 2. There are some predefined tranches for built-in groups of locks.
...@@ -125,6 +125,7 @@ extern slock_t *ShmemLock; ...@@ -125,6 +125,7 @@ extern slock_t *ShmemLock;
* All these names are user-visible as wait event names, so choose with care * All these names are user-visible as wait event names, so choose with care
* ... and do not forget to update the documentation's list of wait events. * ... and do not forget to update the documentation's list of wait events.
*/ */
extern const char *const IndividualLWLockNames[]; /* in lwlocknames.c */
static const char *const BuiltinTrancheNames[] = { static const char *const BuiltinTrancheNames[] = {
/* LWTRANCHE_XACT_BUFFER: */ /* LWTRANCHE_XACT_BUFFER: */
...@@ -781,7 +782,7 @@ GetLWTrancheName(uint16 trancheId) ...@@ -781,7 +782,7 @@ GetLWTrancheName(uint16 trancheId)
{ {
/* Individual LWLock? */ /* Individual LWLock? */
if (trancheId < NUM_INDIVIDUAL_LWLOCKS) if (trancheId < NUM_INDIVIDUAL_LWLOCKS)
return MainLWLockNames[trancheId]; return IndividualLWLockNames[trancheId];
/* Built-in tranche? */ /* Built-in tranche? */
if (trancheId < LWTRANCHE_FIRST_USER_DEFINED) if (trancheId < LWTRANCHE_FIRST_USER_DEFINED)
......
...@@ -88,7 +88,6 @@ typedef union LWLockMinimallyPadded ...@@ -88,7 +88,6 @@ typedef union LWLockMinimallyPadded
} LWLockMinimallyPadded; } LWLockMinimallyPadded;
extern PGDLLIMPORT LWLockPadded *MainLWLockArray; extern PGDLLIMPORT LWLockPadded *MainLWLockArray;
extern const char *const MainLWLockNames[];
/* struct for storing named tranche information */ /* struct for storing named tranche information */
typedef struct NamedLWLockTranche typedef struct NamedLWLockTranche
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment