Skip to content

Commit 110eb4a

Browse files
committed
Remove enum WaitEventExtension
This enum was used to determine the first ID to use when assigning a custom wait event for extensions, which is always 1. It was kept so as it would be possible to add new in-core wait events in the category "Extension". There is no such thing currently, so let's remove this enum until a case justifying it pops up. This makes the code simpler and easier to understand. This has as effect to switch back autoprewarm.c to use PG_WAIT_EXTENSION rather than WAIT_EVENT_EXTENSION, on par with v16 and older stable branches. Thinko in c9af054. Reported-by: Peter Eisentraut Discussion: https://postgr.es/m/195c6c45-abce-4331-be6a-e87724e1d060@eisentraut.org
1 parent 372700c commit 110eb4a

File tree

4 files changed

+5
-13
lines changed

4 files changed

+5
-13
lines changed

contrib/pg_prewarm/autoprewarm.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,7 @@ autoprewarm_main(Datum main_arg)
226226
(void) WaitLatch(MyLatch,
227227
WL_LATCH_SET | WL_EXIT_ON_PM_DEATH,
228228
-1L,
229-
WAIT_EVENT_EXTENSION);
229+
PG_WAIT_EXTENSION);
230230
}
231231
else
232232
{
@@ -253,7 +253,7 @@ autoprewarm_main(Datum main_arg)
253253
(void) WaitLatch(MyLatch,
254254
WL_LATCH_SET | WL_TIMEOUT | WL_EXIT_ON_PM_DEATH,
255255
delay_in_ms,
256-
WAIT_EVENT_EXTENSION);
256+
PG_WAIT_EXTENSION);
257257
}
258258

259259
/* Reset the latch, loop. */

src/backend/utils/activity/wait_event.c

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -89,8 +89,7 @@ typedef struct WaitEventExtensionCounterData
8989
static WaitEventExtensionCounterData *WaitEventExtensionCounter;
9090

9191
/* first event ID of custom wait events for extensions */
92-
#define NUM_BUILTIN_WAIT_EVENT_EXTENSION \
93-
(WAIT_EVENT_EXTENSION_FIRST_USER_DEFINED - WAIT_EVENT_EXTENSION)
92+
#define WAIT_EVENT_EXTENSION_INITIAL_ID 1
9493

9594
/* wait event info for extensions */
9695
#define WAIT_EVENT_EXTENSION_INFO(eventId) (PG_WAIT_EXTENSION | eventId)
@@ -129,7 +128,7 @@ WaitEventExtensionShmemInit(void)
129128
if (!found)
130129
{
131130
/* initialize the allocation counter and its spinlock. */
132-
WaitEventExtensionCounter->nextId = NUM_BUILTIN_WAIT_EVENT_EXTENSION;
131+
WaitEventExtensionCounter->nextId = WAIT_EVENT_EXTENSION_INITIAL_ID;
133132
SpinLockInit(&WaitEventExtensionCounter->mutex);
134133
}
135134

@@ -244,7 +243,7 @@ GetWaitEventExtensionIdentifier(uint16 eventId)
244243
WaitEventExtensionEntryById *entry;
245244

246245
/* Built-in event? */
247-
if (eventId < NUM_BUILTIN_WAIT_EVENT_EXTENSION)
246+
if (eventId < WAIT_EVENT_EXTENSION_INITIAL_ID)
248247
return "Extension";
249248

250249
/* It is a user-defined wait event, so lookup hash table. */

src/include/utils/wait_event.h

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -53,12 +53,6 @@ extern PGDLLIMPORT uint32 *my_wait_event_info;
5353
*
5454
* The ID retrieved can be used with pgstat_report_wait_start() or equivalent.
5555
*/
56-
typedef enum
57-
{
58-
WAIT_EVENT_EXTENSION = PG_WAIT_EXTENSION,
59-
WAIT_EVENT_EXTENSION_FIRST_USER_DEFINED,
60-
} WaitEventExtension;
61-
6256
extern void WaitEventExtensionShmemInit(void);
6357
extern Size WaitEventExtensionShmemSize(void);
6458

src/tools/pgindent/typedefs.list

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3100,7 +3100,6 @@ WaitEvent
31003100
WaitEventActivity
31013101
WaitEventBufferPin
31023102
WaitEventClient
3103-
WaitEventExtension
31043103
WaitEventExtensionCounterData
31053104
WaitEventExtensionEntryById
31063105
WaitEventExtensionEntryByName

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy