From 794f8a95ae3b9d25f3293cbf063cf70c5e8f5197 Mon Sep 17 00:00:00 2001
From: Michael Paquier <michael@paquier.xyz>
Date: Mon, 28 Aug 2023 14:47:13 +0900
Subject: [PATCH v3 1/2] Rename wait events with more consistent camelcase
 style

This will help in the introduction of more simplifications with the
generation of wait event data using wait_event_names.txt.  The event
names used the same case-insensitive characters, hence applying lower()
or upper() to the monitoring queries allows the detection of the same
events as before this change.
---
 src/backend/libpq/pqmq.c                      |  2 +-
 src/backend/storage/ipc/shm_mq.c              |  6 +-
 .../utils/activity/wait_event_names.txt       | 90 +++++++++----------
 3 files changed, 49 insertions(+), 49 deletions(-)

diff --git a/src/backend/libpq/pqmq.c b/src/backend/libpq/pqmq.c
index 253181f47a..38b042804c 100644
--- a/src/backend/libpq/pqmq.c
+++ b/src/backend/libpq/pqmq.c
@@ -182,7 +182,7 @@ mq_putmessage(char msgtype, const char *s, size_t len)
 			break;
 
 		(void) WaitLatch(MyLatch, WL_LATCH_SET | WL_EXIT_ON_PM_DEATH, 0,
-						 WAIT_EVENT_MQ_PUT_MESSAGE);
+						 WAIT_EVENT_MESSAGE_QUEUE_PUT_MESSAGE);
 		ResetLatch(MyLatch);
 		CHECK_FOR_INTERRUPTS();
 	}
diff --git a/src/backend/storage/ipc/shm_mq.c b/src/backend/storage/ipc/shm_mq.c
index d134a09a19..06d6b73527 100644
--- a/src/backend/storage/ipc/shm_mq.c
+++ b/src/backend/storage/ipc/shm_mq.c
@@ -1017,7 +1017,7 @@ shm_mq_send_bytes(shm_mq_handle *mqh, Size nbytes, const void *data,
 			 * cheaper than setting one that has been reset.
 			 */
 			(void) WaitLatch(MyLatch, WL_LATCH_SET | WL_EXIT_ON_PM_DEATH, 0,
-							 WAIT_EVENT_MQ_SEND);
+							 WAIT_EVENT_MESSAGE_QUEUE_SEND);
 
 			/* Reset the latch so we don't spin. */
 			ResetLatch(MyLatch);
@@ -1163,7 +1163,7 @@ shm_mq_receive_bytes(shm_mq_handle *mqh, Size bytes_needed, bool nowait,
 		 * setting one that has been reset.
 		 */
 		(void) WaitLatch(MyLatch, WL_LATCH_SET | WL_EXIT_ON_PM_DEATH, 0,
-						 WAIT_EVENT_MQ_RECEIVE);
+						 WAIT_EVENT_MESSAGE_QUEUE_RECEIVE);
 
 		/* Reset the latch so we don't spin. */
 		ResetLatch(MyLatch);
@@ -1252,7 +1252,7 @@ shm_mq_wait_internal(shm_mq *mq, PGPROC **ptr, BackgroundWorkerHandle *handle)
 
 		/* Wait to be signaled. */
 		(void) WaitLatch(MyLatch, WL_LATCH_SET | WL_EXIT_ON_PM_DEATH, 0,
-						 WAIT_EVENT_MQ_INTERNAL);
+						 WAIT_EVENT_MESSAGE_QUEUE_INTERNAL);
 
 		/* Reset the latch so we don't spin. */
 		ResetLatch(MyLatch);
diff --git a/src/backend/utils/activity/wait_event_names.txt b/src/backend/utils/activity/wait_event_names.txt
index 4d74f0068e..99ed44cbc8 100644
--- a/src/backend/utils/activity/wait_event_names.txt
+++ b/src/backend/utils/activity/wait_event_names.txt
@@ -45,15 +45,15 @@
 Section: ClassName - WaitEventActivity
 
 WAIT_EVENT_ARCHIVER_MAIN	ArchiverMain	"Waiting in main loop of archiver process."
-WAIT_EVENT_AUTOVACUUM_MAIN	AutoVacuumMain	"Waiting in main loop of autovacuum launcher process."
-WAIT_EVENT_BGWRITER_HIBERNATE	BgWriterHibernate	"Waiting in background writer process, hibernating."
-WAIT_EVENT_BGWRITER_MAIN	BgWriterMain	"Waiting in main loop of background writer process."
+WAIT_EVENT_AUTOVACUUM_MAIN	AutovacuumMain	"Waiting in main loop of autovacuum launcher process."
+WAIT_EVENT_BGWRITER_HIBERNATE	BgwriterHibernate	"Waiting in background writer process, hibernating."
+WAIT_EVENT_BGWRITER_MAIN	BgwriterMain	"Waiting in main loop of background writer process."
 WAIT_EVENT_CHECKPOINTER_MAIN	CheckpointerMain	"Waiting in main loop of checkpointer process."
 WAIT_EVENT_LOGICAL_APPLY_MAIN	LogicalApplyMain	"Waiting in main loop of logical replication apply process."
 WAIT_EVENT_LOGICAL_LAUNCHER_MAIN	LogicalLauncherMain	"Waiting in main loop of logical replication launcher process."
 WAIT_EVENT_LOGICAL_PARALLEL_APPLY_MAIN	LogicalParallelApplyMain	"Waiting in main loop of logical replication parallel apply process."
 WAIT_EVENT_RECOVERY_WAL_STREAM	RecoveryWalStream	"Waiting in main loop of startup process for WAL to arrive, during streaming recovery."
-WAIT_EVENT_SYSLOGGER_MAIN	SysLoggerMain	"Waiting in main loop of syslogger process."
+WAIT_EVENT_SYSLOGGER_MAIN	SysloggerMain	"Waiting in main loop of syslogger process."
 WAIT_EVENT_WAL_RECEIVER_MAIN	WalReceiverMain	"Waiting in main loop of WAL receiver process."
 WAIT_EVENT_WAL_SENDER_MAIN	WalSenderMain	"Waiting in main loop of WAL sender process."
 WAIT_EVENT_WAL_WRITER_MAIN	WalWriterMain	"Waiting in main loop of WAL writer process."
@@ -71,11 +71,11 @@ Section: ClassName - WaitEventClient
 
 WAIT_EVENT_CLIENT_READ	ClientRead	"Waiting to read data from the client."
 WAIT_EVENT_CLIENT_WRITE	ClientWrite	"Waiting to write data to the client."
-WAIT_EVENT_GSS_OPEN_SERVER	GSSOpenServer	"Waiting to read data from the client while establishing a GSSAPI session."
-WAIT_EVENT_LIBPQWALRECEIVER_CONNECT	LibPQWalReceiverConnect	"Waiting in WAL receiver to establish connection to remote server."
-WAIT_EVENT_LIBPQWALRECEIVER_RECEIVE	LibPQWalReceiverReceive	"Waiting in WAL receiver to receive data from remote server."
-WAIT_EVENT_SSL_OPEN_SERVER	SSLOpenServer	"Waiting for SSL while attempting connection."
-WAIT_EVENT_WAL_SENDER_WAIT_WAL	WalSenderWaitForWAL	"Waiting for WAL to be flushed in WAL sender process."
+WAIT_EVENT_GSS_OPEN_SERVER	GssOpenServer	"Waiting to read data from the client while establishing a GSSAPI session."
+WAIT_EVENT_LIBPQWALRECEIVER_CONNECT	LibpqwalreceiverConnect	"Waiting in WAL receiver to establish connection to remote server."
+WAIT_EVENT_LIBPQWALRECEIVER_RECEIVE	LibpqwalreceiverReceive	"Waiting in WAL receiver to receive data from remote server."
+WAIT_EVENT_SSL_OPEN_SERVER	SslOpenServer	"Waiting for SSL while attempting connection."
+WAIT_EVENT_WAL_SENDER_WAIT_WAL	WalSenderWaitWal	"Waiting for WAL to be flushed in WAL sender process."
 WAIT_EVENT_WAL_SENDER_WRITE_DATA	WalSenderWriteData	"Waiting for any activity when processing replies from WAL receiver in WAL sender process."
 
 
@@ -93,10 +93,10 @@ WAIT_EVENT_ARCHIVE_CLEANUP_COMMAND	ArchiveCleanupCommand	"Waiting for <xref link
 WAIT_EVENT_ARCHIVE_COMMAND	ArchiveCommand	"Waiting for <xref linkend="guc-archive-command"/> to complete."
 WAIT_EVENT_BACKEND_TERMINATION	BackendTermination	"Waiting for the termination of another backend."
 WAIT_EVENT_BACKUP_WAIT_WAL_ARCHIVE	BackupWaitWalArchive	"Waiting for WAL files required for a backup to be successfully archived."
-WAIT_EVENT_BGWORKER_SHUTDOWN	BgWorkerShutdown	"Waiting for background worker to shut down."
-WAIT_EVENT_BGWORKER_STARTUP	BgWorkerStartup	"Waiting for background worker to start up."
+WAIT_EVENT_BGWORKER_SHUTDOWN	BgworkerShutdown	"Waiting for background worker to shut down."
+WAIT_EVENT_BGWORKER_STARTUP	BgworkerStartup	"Waiting for background worker to start up."
 WAIT_EVENT_BTREE_PAGE	BtreePage	"Waiting for the page number needed to continue a parallel B-tree scan to become available."
-WAIT_EVENT_BUFFER_IO	BufferIO	"Waiting for buffer I/O to complete."
+WAIT_EVENT_BUFFER_IO	BufferIo	"Waiting for buffer I/O to complete."
 WAIT_EVENT_CHECKPOINT_DONE	CheckpointDone	"Waiting for a checkpoint to complete."
 WAIT_EVENT_CHECKPOINT_START	CheckpointStart	"Waiting for a checkpoint to start."
 WAIT_EVENT_EXECUTE_GATHER	ExecuteGather	"Waiting for activity from a child process while executing a <literal>Gather</literal> plan node."
@@ -119,14 +119,14 @@ WAIT_EVENT_LOGICAL_APPLY_SEND_DATA	LogicalApplySendData	"Waiting for a logical r
 WAIT_EVENT_LOGICAL_PARALLEL_APPLY_STATE_CHANGE	LogicalParallelApplyStateChange	"Waiting for a logical replication parallel apply process to change state."
 WAIT_EVENT_LOGICAL_SYNC_DATA	LogicalSyncData	"Waiting for a logical replication remote server to send data for initial table synchronization."
 WAIT_EVENT_LOGICAL_SYNC_STATE_CHANGE	LogicalSyncStateChange	"Waiting for a logical replication remote server to change state."
-WAIT_EVENT_MQ_INTERNAL	MessageQueueInternal	"Waiting for another process to be attached to a shared message queue."
-WAIT_EVENT_MQ_PUT_MESSAGE	MessageQueuePutMessage	"Waiting to write a protocol message to a shared message queue."
-WAIT_EVENT_MQ_RECEIVE	MessageQueueReceive	"Waiting to receive bytes from a shared message queue."
-WAIT_EVENT_MQ_SEND	MessageQueueSend	"Waiting to send bytes to a shared message queue."
+WAIT_EVENT_MESSAGE_QUEUE_INTERNAL	MessageQueueInternal	"Waiting for another process to be attached to a shared message queue."
+WAIT_EVENT_MESSAGE_QUEUE_PUT_MESSAGE	MessageQueuePutMessage	"Waiting to write a protocol message to a shared message queue."
+WAIT_EVENT_MESSAGE_QUEUE_RECEIVE	MessageQueueReceive	"Waiting to receive bytes from a shared message queue."
+WAIT_EVENT_MESSAGE_QUEUE_SEND	MessageQueueSend	"Waiting to send bytes to a shared message queue."
 WAIT_EVENT_PARALLEL_BITMAP_SCAN	ParallelBitmapScan	"Waiting for parallel bitmap scan to become initialized."
 WAIT_EVENT_PARALLEL_CREATE_INDEX_SCAN	ParallelCreateIndexScan	"Waiting for parallel <command>CREATE INDEX</command> workers to finish heap scan."
 WAIT_EVENT_PARALLEL_FINISH	ParallelFinish	"Waiting for parallel workers to finish computing."
-WAIT_EVENT_PROCARRAY_GROUP_UPDATE	ProcArrayGroupUpdate	"Waiting for the group leader to clear the transaction ID at end of a parallel operation."
+WAIT_EVENT_PROCARRAY_GROUP_UPDATE	ProcarrayGroupUpdate	"Waiting for the group leader to clear the transaction ID at end of a parallel operation."
 WAIT_EVENT_PROC_SIGNAL_BARRIER	ProcSignalBarrier	"Waiting for a barrier event to be processed by all backends."
 WAIT_EVENT_PROMOTE	Promote	"Waiting for standby promotion."
 WAIT_EVENT_RECOVERY_CONFLICT_SNAPSHOT	RecoveryConflictSnapshot	"Waiting for recovery conflict resolution for a vacuum cleanup."
@@ -170,12 +170,12 @@ WAIT_EVENT_VACUUM_TRUNCATE	VacuumTruncate	"Waiting to acquire an exclusive lock
 
 Section: ClassName - WaitEventIO
 
-WAIT_EVENT_BASEBACKUP_READ	BaseBackupRead	"Waiting for base backup to read from a file."
-WAIT_EVENT_BASEBACKUP_SYNC	BaseBackupSync	"Waiting for data written by a base backup to reach durable storage."
-WAIT_EVENT_BASEBACKUP_WRITE	BaseBackupWrite	"Waiting for base backup to write to a file."
-WAIT_EVENT_BUFFILE_READ	BufFileRead	"Waiting for a read from a buffered file."
-WAIT_EVENT_BUFFILE_WRITE	BufFileWrite	"Waiting for a write to a buffered file."
-WAIT_EVENT_BUFFILE_TRUNCATE	BufFileTruncate	"Waiting for a buffered file to be truncated."
+WAIT_EVENT_BASEBACKUP_READ	BasebackupRead	"Waiting for base backup to read from a file."
+WAIT_EVENT_BASEBACKUP_SYNC	BasebackupSync	"Waiting for data written by a base backup to reach durable storage."
+WAIT_EVENT_BASEBACKUP_WRITE	BasebackupWrite	"Waiting for base backup to write to a file."
+WAIT_EVENT_BUFFILE_READ	BuffileRead	"Waiting for a read from a buffered file."
+WAIT_EVENT_BUFFILE_WRITE	BuffileWrite	"Waiting for a write to a buffered file."
+WAIT_EVENT_BUFFILE_TRUNCATE	BuffileTruncate	"Waiting for a buffered file to be truncated."
 WAIT_EVENT_CONTROL_FILE_READ	ControlFileRead	"Waiting for a read from the <filename>pg_control</filename> file."
 WAIT_EVENT_CONTROL_FILE_SYNC	ControlFileSync	"Waiting for the <filename>pg_control</filename> file to reach durable storage."
 WAIT_EVENT_CONTROL_FILE_SYNC_UPDATE	ControlFileSyncUpdate	"Waiting for an update to the <filename>pg_control</filename> file to reach durable storage."
@@ -191,15 +191,15 @@ WAIT_EVENT_DATA_FILE_READ	DataFileRead	"Waiting for a read from a relation data
 WAIT_EVENT_DATA_FILE_SYNC	DataFileSync	"Waiting for changes to a relation data file to reach durable storage."
 WAIT_EVENT_DATA_FILE_TRUNCATE	DataFileTruncate	"Waiting for a relation data file to be truncated."
 WAIT_EVENT_DATA_FILE_WRITE	DataFileWrite	"Waiting for a write to a relation data file."
-WAIT_EVENT_DSM_ALLOCATE	DSMAllocate	"Waiting for a dynamic shared memory segment to be allocated."
-WAIT_EVENT_DSM_FILL_ZERO_WRITE	DSMFillZeroWrite	"Waiting to fill a dynamic shared memory backing file with zeroes."
-WAIT_EVENT_LOCK_FILE_ADDTODATADIR_READ	LockFileAddToDataDirRead	"Waiting for a read while adding a line to the data directory lock file."
-WAIT_EVENT_LOCK_FILE_ADDTODATADIR_SYNC	LockFileAddToDataDirSync	"Waiting for data to reach durable storage while adding a line to the data directory lock file."
-WAIT_EVENT_LOCK_FILE_ADDTODATADIR_WRITE	LockFileAddToDataDirWrite	"Waiting for a write while adding a line to the data directory lock file."
+WAIT_EVENT_DSM_ALLOCATE	DsmAllocate	"Waiting for a dynamic shared memory segment to be allocated."
+WAIT_EVENT_DSM_FILL_ZERO_WRITE	DsmFillZeroWrite	"Waiting to fill a dynamic shared memory backing file with zeroes."
+WAIT_EVENT_LOCK_FILE_ADDTODATADIR_READ	LockFileAddtodatadirRead	"Waiting for a read while adding a line to the data directory lock file."
+WAIT_EVENT_LOCK_FILE_ADDTODATADIR_SYNC	LockFileAddtodatadirSync	"Waiting for data to reach durable storage while adding a line to the data directory lock file."
+WAIT_EVENT_LOCK_FILE_ADDTODATADIR_WRITE	LockFileAddtodatadirWrite	"Waiting for a write while adding a line to the data directory lock file."
 WAIT_EVENT_LOCK_FILE_CREATE_READ	LockFileCreateRead	"Waiting to read while creating the data directory lock file."
 WAIT_EVENT_LOCK_FILE_CREATE_SYNC	LockFileCreateSync	"Waiting for data to reach durable storage while creating the data directory lock file."
 WAIT_EVENT_LOCK_FILE_CREATE_WRITE	LockFileCreateWrite	"Waiting for a write while creating the data directory lock file."
-WAIT_EVENT_LOCK_FILE_RECHECKDATADIR_READ	LockFileReCheckDataDirRead	"Waiting for a read during recheck of the data directory lock file."
+WAIT_EVENT_LOCK_FILE_RECHECKDATADIR_READ	LockFileRecheckdatadirRead	"Waiting for a read during recheck of the data directory lock file."
 WAIT_EVENT_LOGICAL_REWRITE_CHECKPOINT_SYNC	LogicalRewriteCheckpointSync	"Waiting for logical rewrite mappings to reach durable storage during a checkpoint."
 WAIT_EVENT_LOGICAL_REWRITE_MAPPING_SYNC	LogicalRewriteMappingSync	"Waiting for mapping data to reach durable storage during a logical rewrite."
 WAIT_EVENT_LOGICAL_REWRITE_MAPPING_WRITE	LogicalRewriteMappingWrite	"Waiting for a write of mapping data during a logical rewrite."
@@ -216,10 +216,10 @@ WAIT_EVENT_REPLICATION_SLOT_READ	ReplicationSlotRead	"Waiting for a read from a
 WAIT_EVENT_REPLICATION_SLOT_RESTORE_SYNC	ReplicationSlotRestoreSync	"Waiting for a replication slot control file to reach durable storage while restoring it to memory."
 WAIT_EVENT_REPLICATION_SLOT_SYNC	ReplicationSlotSync	"Waiting for a replication slot control file to reach durable storage."
 WAIT_EVENT_REPLICATION_SLOT_WRITE	ReplicationSlotWrite	"Waiting for a write to a replication slot control file."
-WAIT_EVENT_SLRU_FLUSH_SYNC	SLRUFlushSync	"Waiting for SLRU data to reach durable storage during a checkpoint or database shutdown."
-WAIT_EVENT_SLRU_READ	SLRURead	"Waiting for a read of an SLRU page."
-WAIT_EVENT_SLRU_SYNC	SLRUSync	"Waiting for SLRU data to reach durable storage following a page write."
-WAIT_EVENT_SLRU_WRITE	SLRUWrite	"Waiting for a write of an SLRU page."
+WAIT_EVENT_SLRU_FLUSH_SYNC	SlruFlushSync	"Waiting for SLRU data to reach durable storage during a checkpoint or database shutdown."
+WAIT_EVENT_SLRU_READ	SlruRead	"Waiting for a read of an SLRU page."
+WAIT_EVENT_SLRU_SYNC	SlruSync	"Waiting for SLRU data to reach durable storage following a page write."
+WAIT_EVENT_SLRU_WRITE	SlruWrite	"Waiting for a write of an SLRU page."
 WAIT_EVENT_SNAPBUILD_READ	SnapbuildRead	"Waiting for a read of a serialized historical catalog snapshot."
 WAIT_EVENT_SNAPBUILD_SYNC	SnapbuildSync	"Waiting for a serialized historical catalog snapshot to reach durable storage."
 WAIT_EVENT_SNAPBUILD_WRITE	SnapbuildWrite	"Waiting for a write of a serialized historical catalog snapshot."
@@ -232,18 +232,18 @@ WAIT_EVENT_TWOPHASE_FILE_READ	TwophaseFileRead	"Waiting for a read of a two phas
 WAIT_EVENT_TWOPHASE_FILE_SYNC	TwophaseFileSync	"Waiting for a two phase state file to reach durable storage."
 WAIT_EVENT_TWOPHASE_FILE_WRITE	TwophaseFileWrite	"Waiting for a write of a two phase state file."
 WAIT_EVENT_VERSION_FILE_WRITE	VersionFileWrite	"Waiting for the version file to be written while creating a database."
-WAIT_EVENT_WALSENDER_TIMELINE_HISTORY_READ	WALSenderTimelineHistoryRead	"Waiting for a read from a timeline history file during a walsender timeline command."
-WAIT_EVENT_WAL_BOOTSTRAP_SYNC	WALBootstrapSync	"Waiting for WAL to reach durable storage during bootstrapping."
-WAIT_EVENT_WAL_BOOTSTRAP_WRITE	WALBootstrapWrite	"Waiting for a write of a WAL page during bootstrapping."
-WAIT_EVENT_WAL_COPY_READ	WALCopyRead	"Waiting for a read when creating a new WAL segment by copying an existing one."
-WAIT_EVENT_WAL_COPY_SYNC	WALCopySync	"Waiting for a new WAL segment created by copying an existing one to reach durable storage."
-WAIT_EVENT_WAL_COPY_WRITE	WALCopyWrite	"Waiting for a write when creating a new WAL segment by copying an existing one."
-WAIT_EVENT_WAL_INIT_SYNC	WALInitSync	"Waiting for a newly initialized WAL file to reach durable storage."
-WAIT_EVENT_WAL_INIT_WRITE	WALInitWrite	"Waiting for a write while initializing a new WAL file."
-WAIT_EVENT_WAL_READ	WALRead	"Waiting for a read from a WAL file."
-WAIT_EVENT_WAL_SYNC	WALSync	"Waiting for a WAL file to reach durable storage."
-WAIT_EVENT_WAL_SYNC_METHOD_ASSIGN	WALSyncMethodAssign	"Waiting for data to reach durable storage while assigning a new WAL sync method."
-WAIT_EVENT_WAL_WRITE	WALWrite	"Waiting for a write to a WAL file."
+WAIT_EVENT_WALSENDER_TIMELINE_HISTORY_READ	WalsenderTimelineHistoryRead	"Waiting for a read from a timeline history file during a walsender timeline command."
+WAIT_EVENT_WAL_BOOTSTRAP_SYNC	WalBootstrapSync	"Waiting for WAL to reach durable storage during bootstrapping."
+WAIT_EVENT_WAL_BOOTSTRAP_WRITE	WalBootstrapWrite	"Waiting for a write of a WAL page during bootstrapping."
+WAIT_EVENT_WAL_COPY_READ	WalCopyRead	"Waiting for a read when creating a new WAL segment by copying an existing one."
+WAIT_EVENT_WAL_COPY_SYNC	WalCopySync	"Waiting for a new WAL segment created by copying an existing one to reach durable storage."
+WAIT_EVENT_WAL_COPY_WRITE	WalCopyWrite	"Waiting for a write when creating a new WAL segment by copying an existing one."
+WAIT_EVENT_WAL_INIT_SYNC	WalInitSync	"Waiting for a newly initialized WAL file to reach durable storage."
+WAIT_EVENT_WAL_INIT_WRITE	WalInitWrite	"Waiting for a write while initializing a new WAL file."
+WAIT_EVENT_WAL_READ	WalRead	"Waiting for a read from a WAL file."
+WAIT_EVENT_WAL_SYNC	WalSync	"Waiting for a WAL file to reach durable storage."
+WAIT_EVENT_WAL_SYNC_METHOD_ASSIGN	WalSyncMethodAssign	"Waiting for data to reach durable storage while assigning a new WAL sync method."
+WAIT_EVENT_WAL_WRITE	WalWrite	"Waiting for a write to a WAL file."
 
 
 #
-- 
2.40.1

