Skip to content

Commit 474e7da

Browse files
committed
Change locktype "speculative token" to "spectoken".
It's just weird that this name wasn't chosen to look like an identifier. The suspicion that it wasn't thought about too hard is reinforced by the fact that it wasn't documented in the pg_locks view (until I did so, a day or two back). Update, and add a comment reminding future adjusters of this array to fix the docs too. Do some desultory wordsmithing on various entries in the wait events tables. Discussion: https://postgr.es/m/[email protected]
1 parent 1d37430 commit 474e7da

File tree

5 files changed

+58
-56
lines changed

5 files changed

+58
-56
lines changed

doc/src/sgml/catalogs.sgml

+1-1
Original file line numberDiff line numberDiff line change
@@ -10238,7 +10238,7 @@ SCRAM-SHA-256$<replaceable>&lt;iteration count&gt;</replaceable>:<replaceable>&l
1023810238
<literal>tuple</literal>,
1023910239
<literal>transactionid</literal>,
1024010240
<literal>virtualxid</literal>,
10241-
<literal>speculative token</literal>,
10241+
<literal>spectoken</literal>,
1024210242
<literal>object</literal>,
1024310243
<literal>userlock</literal>, or
1024410244
<literal>advisory</literal>.

doc/src/sgml/monitoring.sgml

+46-47
Original file line numberDiff line numberDiff line change
@@ -919,68 +919,66 @@ postgres 27093 0.0 0.0 30096 2752 ? Ss 11:34 0:00 postgres: ser
919919
<tbody>
920920
<row>
921921
<entry><literal>Activity</literal></entry>
922-
<entry>The server process is idle. This is used by
923-
system processes waiting for activity in their main processing loop.
924-
<literal>wait_event</literal> will identify the specific wait point.
925-
See <xref linkend="wait-event-activity-table"/>.
922+
<entry>The server process is idle. This event type indicates a process
923+
waiting for activity in its main processing loop.
924+
<literal>wait_event</literal> will identify the specific wait point;
925+
see <xref linkend="wait-event-activity-table"/>.
926926
</entry>
927927
</row>
928928
<row>
929929
<entry><literal>BufferPin</literal></entry>
930-
<entry>The server process is waiting to access to
931-
a data buffer during a period when no other process can be
932-
examining that buffer. Buffer pin waits can be protracted if
933-
another process holds an open cursor which last read data from the
930+
<entry>The server process is waiting for exclusive access to
931+
a data buffer. Buffer pin waits can be protracted if
932+
another process holds an open cursor that last read data from the
934933
buffer in question. See <xref linkend="wait-event-bufferpin-table"/>.
935934
</entry>
936935
</row>
937936
<row>
938937
<entry><literal>Client</literal></entry>
939-
<entry>The server process is waiting for some activity
940-
on a socket from user applications, and that the server expects
941-
something to happen that is independent from its internal processes.
942-
<literal>wait_event</literal> will identify the specific wait point.
943-
See <xref linkend="wait-event-client-table"/>.
938+
<entry>The server process is waiting for activity on a socket
939+
connected to a user application. Thus, the server expects something
940+
to happen that is independent of its internal processes.
941+
<literal>wait_event</literal> will identify the specific wait point;
942+
see <xref linkend="wait-event-client-table"/>.
944943
</entry>
945944
</row>
946945
<row>
947946
<entry><literal>Extension</literal></entry>
948-
<entry>The server process is waiting for activity
949-
in an extension module. This category is useful for modules to
950-
track custom waiting points.
947+
<entry>The server process is waiting for some condition defined by an
948+
extension module.
951949
See <xref linkend="wait-event-extension-table"/>.
952950
</entry>
953951
</row>
954952
<row>
955953
<entry><literal>IO</literal></entry>
956-
<entry>The server process is waiting for a IO to complete.
957-
<literal>wait_event</literal> will identify the specific wait point.
958-
See <xref linkend="wait-event-io-table"/>.
954+
<entry>The server process is waiting for an I/O operation to complete.
955+
<literal>wait_event</literal> will identify the specific wait point;
956+
see <xref linkend="wait-event-io-table"/>.
959957
</entry>
960958
</row>
961959
<row>
962960
<entry><literal>IPC</literal></entry>
963-
<entry>The server process is waiting for some activity
964-
from another process in the server. <literal>wait_event</literal> will
965-
identify the specific wait point.
966-
See <xref linkend="wait-event-ipc-table"/>.
961+
<entry>The server process is waiting for some interaction with
962+
another server process. <literal>wait_event</literal> will
963+
identify the specific wait point;
964+
see <xref linkend="wait-event-ipc-table"/>.
967965
</entry>
968966
</row>
969967
<row>
970968
<entry><literal>Lock</literal></entry>
971-
<entry>The backend is waiting for a heavyweight lock.
969+
<entry>The server process is waiting for a heavyweight lock.
972970
Heavyweight locks, also known as lock manager locks or simply locks,
973971
primarily protect SQL-visible objects such as tables. However,
974972
they are also used to ensure mutual exclusion for certain internal
975973
operations such as relation extension. <literal>wait_event</literal>
976-
will identify the type of lock awaited.
977-
See <xref linkend="wait-event-lock-table"/>.
974+
will identify the type of lock awaited;
975+
see <xref linkend="wait-event-lock-table"/>.
978976
</entry>
979977
</row>
980978
<row>
981979
<entry><literal>LWLock</literal></entry>
982-
<entry> The backend is waiting for a lightweight lock.
983-
Each such lock protects a particular data structure in shared memory.
980+
<entry> The server process is waiting for a lightweight lock.
981+
Most such locks protect a particular data structure in shared memory.
984982
<literal>wait_event</literal> will contain a name identifying the purpose
985983
of the lightweight lock. (Some locks have specific names; others
986984
are part of a group of locks each with a similar purpose.)
@@ -991,7 +989,7 @@ postgres 27093 0.0 0.0 30096 2752 ? Ss 11:34 0:00 postgres: ser
991989
<entry><literal>Timeout</literal></entry>
992990
<entry>The server process is waiting for a timeout
993991
to expire. <literal>wait_event</literal> will identify the specific wait
994-
point. See <xref linkend="wait-event-timeout-table"/>.
992+
point; see <xref linkend="wait-event-timeout-table"/>.
995993
</entry>
996994
</row>
997995
</tbody>
@@ -1011,7 +1009,7 @@ postgres 27093 0.0 0.0 30096 2752 ? Ss 11:34 0:00 postgres: ser
10111009
<tbody>
10121010
<row>
10131011
<entry><literal>ArchiverMain</literal></entry>
1014-
<entry>Waiting in main loop of the archiver process.</entry>
1012+
<entry>Waiting in main loop of archiver process.</entry>
10151013
</row>
10161014
<row>
10171015
<entry><literal>AutoVacuumMain</literal></entry>
@@ -1023,28 +1021,28 @@ postgres 27093 0.0 0.0 30096 2752 ? Ss 11:34 0:00 postgres: ser
10231021
</row>
10241022
<row>
10251023
<entry><literal>BgWriterMain</literal></entry>
1026-
<entry>Waiting in main loop of background writer process background
1027-
worker.</entry>
1024+
<entry>Waiting in main loop of background writer process.</entry>
10281025
</row>
10291026
<row>
10301027
<entry><literal>CheckpointerMain</literal></entry>
10311028
<entry>Waiting in main loop of checkpointer process.</entry>
10321029
</row>
10331030
<row>
10341031
<entry><literal>LogicalApplyMain</literal></entry>
1035-
<entry>Waiting in main loop of logical apply process.</entry>
1032+
<entry>Waiting in main loop of logical replication apply process.</entry>
10361033
</row>
10371034
<row>
10381035
<entry><literal>LogicalLauncherMain</literal></entry>
1039-
<entry>Waiting in main loop of logical launcher process.</entry>
1036+
<entry>Waiting in main loop of logical replication launcher process.</entry>
10401037
</row>
10411038
<row>
10421039
<entry><literal>PgStatMain</literal></entry>
1043-
<entry>Waiting in main loop of the statistics collector process.</entry>
1040+
<entry>Waiting in main loop of statistics collector process.</entry>
10441041
</row>
10451042
<row>
10461043
<entry><literal>RecoveryWalStream</literal></entry>
1047-
<entry>Waiting for WAL from a stream at recovery.</entry>
1044+
<entry>Waiting in main loop of startup process for WAL to arrive, during
1045+
streaming recovery.</entry>
10481046
</row>
10491047
<row>
10501048
<entry><literal>SysLoggerMain</literal></entry>
@@ -1079,7 +1077,7 @@ postgres 27093 0.0 0.0 30096 2752 ? Ss 11:34 0:00 postgres: ser
10791077
<tbody>
10801078
<row>
10811079
<entry><literal>BufferPin</literal></entry>
1082-
<entry>Waiting to acquire a pin on a buffer.</entry>
1080+
<entry>Waiting to acquire an exclusive pin on a buffer.</entry>
10831081
</row>
10841082
</tbody>
10851083
</tgroup>
@@ -1106,7 +1104,7 @@ postgres 27093 0.0 0.0 30096 2752 ? Ss 11:34 0:00 postgres: ser
11061104
</row>
11071105
<row>
11081106
<entry><literal>GSSOpenServer</literal></entry>
1109-
<entry>Waiting to read data from the client while establishing the GSSAPI
1107+
<entry>Waiting to read data from the client while establishing a GSSAPI
11101108
session.</entry>
11111109
</row>
11121110
<row>
@@ -1708,14 +1706,14 @@ postgres 27093 0.0 0.0 30096 2752 ? Ss 11:34 0:00 postgres: ser
17081706
</row>
17091707
<row>
17101708
<entry><literal>page</literal></entry>
1711-
<entry>Waiting to acquire a lock on page of a relation.</entry>
1709+
<entry>Waiting to acquire a lock on a page of a relation.</entry>
17121710
</row>
17131711
<row>
17141712
<entry><literal>relation</literal></entry>
17151713
<entry>Waiting to acquire a lock on a relation.</entry>
17161714
</row>
17171715
<row>
1718-
<entry><literal>speculative token</literal></entry>
1716+
<entry><literal>spectoken</literal></entry>
17191717
<entry>Waiting to acquire a speculative insertion lock.</entry>
17201718
</row>
17211719
<row>
@@ -1732,7 +1730,7 @@ postgres 27093 0.0 0.0 30096 2752 ? Ss 11:34 0:00 postgres: ser
17321730
</row>
17331731
<row>
17341732
<entry><literal>virtualxid</literal></entry>
1735-
<entry>Waiting to acquire a virtual xid lock.</entry>
1733+
<entry>Waiting to acquire a virtual transaction ID lock.</entry>
17361734
</row>
17371735
</tbody>
17381736
</tgroup>
@@ -2072,7 +2070,7 @@ postgres 27093 0.0 0.0 30096 2752 ? Ss 11:34 0:00 postgres: ser
20722070
Extensions can add <literal>LWLock</literal> types to the list shown in
20732071
<xref linkend="wait-event-lwlock-table"/>. In some cases, the name
20742072
assigned by an extension will not be available in all server processes;
2075-
so a wait event might be reported as
2073+
so an <literal>LWLock</literal> wait event might be reported as
20762074
just <quote><literal>extension</literal></quote> rather than the
20772075
extension-assigned name.
20782076
</para>
@@ -2095,17 +2093,18 @@ postgres 27093 0.0 0.0 30096 2752 ? Ss 11:34 0:00 postgres: ser
20952093
</row>
20962094
<row>
20972095
<entry><literal>PgSleep</literal></entry>
2098-
<entry>Waiting in process that called <function>pg_sleep</function>.</entry>
2096+
<entry>Waiting due to a call to <function>pg_sleep</function> or
2097+
a sibling function.</entry>
20992098
</row>
21002099
<row>
21012100
<entry><literal>RecoveryApplyDelay</literal></entry>
2102-
<entry>Waiting to apply WAL at recovery because it is delayed.</entry>
2101+
<entry>Waiting to apply WAL during recovery because of a delay
2102+
setting.</entry>
21032103
</row>
21042104
<row>
21052105
<entry><literal>RecoveryRetrieveRetryInterval</literal></entry>
2106-
<entry>Waiting when WAL data is not available from any kind of sources
2107-
(<filename>pg_wal</filename>, archive or stream) before trying
2108-
again to retrieve WAL data, at recovery.</entry>
2106+
<entry>Waiting during recovery when WAL data is not available from any
2107+
source (<filename>pg_wal</filename>, archive or stream).</entry>
21092108
</row>
21102109
<row>
21112110
<entry><literal>VacuumDelay</literal></entry>

src/backend/utils/adt/lockfuncs.c

+5-2
Original file line numberDiff line numberDiff line change
@@ -22,15 +22,18 @@
2222
#include "utils/builtins.h"
2323

2424

25-
/* This must match enum LockTagType! */
25+
/*
26+
* This must match enum LockTagType! Also, be sure to document any changes
27+
* in the docs for the pg_locks view and for wait event types.
28+
*/
2629
const char *const LockTagTypeNames[] = {
2730
"relation",
2831
"extend",
2932
"page",
3033
"tuple",
3134
"transactionid",
3235
"virtualxid",
33-
"speculative token",
36+
"spectoken",
3437
"object",
3538
"userlock",
3639
"advisory"

src/test/isolation/expected/insert-conflict-specconflict.out

+5-5
Original file line numberDiff line numberDiff line change
@@ -362,16 +362,16 @@ step controller_print_speculative_locks:
362362
SELECT pa.application_name, locktype, mode, granted
363363
FROM pg_locks pl JOIN pg_stat_activity pa USING (pid)
364364
WHERE
365-
locktype IN ('speculative token', 'transactionid')
365+
locktype IN ('spectoken', 'transactionid')
366366
AND pa.datname = current_database()
367367
AND pa.application_name LIKE 'isolation/insert-conflict-specconflict-s%'
368368
ORDER BY 1, 2, 3, 4;
369369

370370
application_namelocktype mode granted
371371

372-
isolation/insert-conflict-specconflict-s1speculative tokenShareLock f
372+
isolation/insert-conflict-specconflict-s1spectoken ShareLock f
373373
isolation/insert-conflict-specconflict-s1transactionid ExclusiveLock t
374-
isolation/insert-conflict-specconflict-s2speculative tokenExclusiveLock t
374+
isolation/insert-conflict-specconflict-s2spectoken ExclusiveLock t
375375
isolation/insert-conflict-specconflict-s2transactionid ExclusiveLock t
376376
step controller_unlock_2_4: SELECT pg_advisory_unlock(2, 4);
377377
pg_advisory_unlock
@@ -384,7 +384,7 @@ step controller_print_speculative_locks:
384384
SELECT pa.application_name, locktype, mode, granted
385385
FROM pg_locks pl JOIN pg_stat_activity pa USING (pid)
386386
WHERE
387-
locktype IN ('speculative token', 'transactionid')
387+
locktype IN ('spectoken', 'transactionid')
388388
AND pa.datname = current_database()
389389
AND pa.application_name LIKE 'isolation/insert-conflict-specconflict-s%'
390390
ORDER BY 1, 2, 3, 4;
@@ -406,7 +406,7 @@ step controller_print_speculative_locks:
406406
SELECT pa.application_name, locktype, mode, granted
407407
FROM pg_locks pl JOIN pg_stat_activity pa USING (pid)
408408
WHERE
409-
locktype IN ('speculative token', 'transactionid')
409+
locktype IN ('spectoken', 'transactionid')
410410
AND pa.datname = current_database()
411411
AND pa.application_name LIKE 'isolation/insert-conflict-specconflict-s%'
412412
ORDER BY 1, 2, 3, 4;

src/test/isolation/specs/insert-conflict-specconflict.spec

+1-1
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ step "controller_print_speculative_locks" {
6464
SELECT pa.application_name, locktype, mode, granted
6565
FROM pg_locks pl JOIN pg_stat_activity pa USING (pid)
6666
WHERE
67-
locktype IN ('speculative token', 'transactionid')
67+
locktype IN ('spectoken', 'transactionid')
6868
AND pa.datname = current_database()
6969
AND pa.application_name LIKE 'isolation/insert-conflict-specconflict-s%'
7070
ORDER BY 1, 2, 3, 4;

0 commit comments

Comments
 (0)