Rename BUFFERPIN wait event class to BUFFER
authorAndres Freund <andres@anarazel.de>
Wed, 3 Dec 2025 23:38:20 +0000 (18:38 -0500)
committerAndres Freund <andres@anarazel.de>
Wed, 3 Dec 2025 23:38:20 +0000 (18:38 -0500)
In an upcoming patch more wait events will be added to the wait event
class (for buffer locking), making the current name too
specific. Alternatively we could introduce a dedicated wait event class for
those, but it seems somewhat confusing to have a BUFFERPIN and a BUFFER wait
event class.

Reviewed-by: Melanie Plageman <melanieplageman@gmail.com>
Discussion: https://postgr.es/m/fvfmkr5kk4nyex56ejgxj3uzi63isfxovp2biecb4bspbjrze7@az2pljabhnff

doc/src/sgml/monitoring.sgml
src/backend/storage/buffer/bufmgr.c
src/backend/storage/ipc/standby.c
src/backend/utils/activity/wait_event.c
src/backend/utils/activity/wait_event_names.txt
src/include/utils/wait_classes.h
src/test/recovery/t/048_vacuum_horizon_floor.pl
src/test/regress/expected/sysviews.out
src/tools/pgindent/typedefs.list

index e0556b6baacce78de08a7c35ccfe0a7076b58979..039d73691be10fb7bb26d75ebfe649438e60e685 100644 (file)
@@ -1053,11 +1053,9 @@ postgres   27093  0.0  0.0  30096  2752 ?        Ss   11:34   0:00 postgres: ser
       </entry>
      </row>
      <row>
-      <entry><literal>BufferPin</literal></entry>
-      <entry>The server process is waiting for exclusive access to
-       a data buffer.  Buffer pin waits can be protracted if
-       another process holds an open cursor that last read data from the
-       buffer in question. See <xref linkend="wait-event-bufferpin-table"/>.
+      <entry><literal>Buffer</literal></entry>
+      <entry>The server process is waiting for access to a data buffer.
+      See <xref linkend="wait-event-buffer-table"/>.
       </entry>
      </row>
      <row>
index 00d9a23b67569f2e332d6ed48f5c48557df14786..62f420dd34463db4d316ffa6d0048540f9e35c18 100644 (file)
@@ -5799,7 +5799,7 @@ LockBufferForCleanup(Buffer buffer)
            SetStartupBufferPinWaitBufId(-1);
        }
        else
-           ProcWaitForSignal(WAIT_EVENT_BUFFER_PIN);
+           ProcWaitForSignal(WAIT_EVENT_BUFFER_CLEANUP);
 
        /*
         * Remove flag marking us as waiter. Normally this will not be set
index 4222bdab07807cbfd99910232fc7c7a104ac0258..fc45d72c79bcea4ba13c74e2651f8eac58588e71 100644 (file)
@@ -840,7 +840,7 @@ ResolveRecoveryConflictWithBufferPin(void)
     * SIGHUP signal handler, etc cannot do that because it uses the different
     * latch from that ProcWaitForSignal() waits on.
     */
-   ProcWaitForSignal(WAIT_EVENT_BUFFER_PIN);
+   ProcWaitForSignal(WAIT_EVENT_BUFFER_CLEANUP);
 
    if (got_standby_delay_timeout)
        SendRecoveryConflictWithBufferPin(PROCSIG_RECOVERY_CONFLICT_BUFFERPIN);
index d9b8f34a3559dc64e0ca3c694ebabc32b5bd890c..96d61f77f6effc1bd85e12d8b94ee99b788564bd 100644 (file)
@@ -29,7 +29,7 @@
 
 
 static const char *pgstat_get_wait_activity(WaitEventActivity w);
-static const char *pgstat_get_wait_bufferpin(WaitEventBufferPin w);
+static const char *pgstat_get_wait_buffer(WaitEventBuffer w);
 static const char *pgstat_get_wait_client(WaitEventClient w);
 static const char *pgstat_get_wait_ipc(WaitEventIPC w);
 static const char *pgstat_get_wait_timeout(WaitEventTimeout w);
@@ -389,8 +389,8 @@ pgstat_get_wait_event_type(uint32 wait_event_info)
        case PG_WAIT_LOCK:
            event_type = "Lock";
            break;
-       case PG_WAIT_BUFFERPIN:
-           event_type = "BufferPin";
+       case PG_WAIT_BUFFER:
+           event_type = "Buffer";
            break;
        case PG_WAIT_ACTIVITY:
            event_type = "Activity";
@@ -453,11 +453,11 @@ pgstat_get_wait_event(uint32 wait_event_info)
        case PG_WAIT_INJECTIONPOINT:
            event_name = GetWaitEventCustomIdentifier(wait_event_info);
            break;
-       case PG_WAIT_BUFFERPIN:
+       case PG_WAIT_BUFFER:
            {
-               WaitEventBufferPin w = (WaitEventBufferPin) wait_event_info;
+               WaitEventBuffer w = (WaitEventBuffer) wait_event_info;
 
-               event_name = pgstat_get_wait_bufferpin(w);
+               event_name = pgstat_get_wait_buffer(w);
                break;
            }
        case PG_WAIT_ACTIVITY:
index c1ac71ff7f24c3fa5b51fe8fbb33dfd1d8af41ed..1e5e368a5dc9b7f1c05575fa783b2245294b34c4 100644 (file)
@@ -279,12 +279,12 @@ WAL_WRITE "Waiting for a write to a WAL file."
 ABI_compatibility:
 
 #
-# Wait Events - Buffer Pin
+# Wait Events - Buffer
 #
 
-Section: ClassName - WaitEventBufferPin
+Section: ClassName - WaitEventBuffer
 
-BUFFER_PIN "Waiting to acquire an exclusive pin on a buffer."
+BUFFER_CLEANUP "Waiting to acquire an exclusive pin on a buffer. Buffer pin waits can be protracted if another process holds an open cursor that last read data from the buffer in question."
 
 ABI_compatibility:
 
index 51ee68397d5952c01bf4efd8189cecb5c8142f08..57888aa62f79c5da83c7a57a9d95e33fbde07630 100644 (file)
@@ -17,7 +17,7 @@
  */
 #define PG_WAIT_LWLOCK             0x01000000U
 #define PG_WAIT_LOCK               0x03000000U
-#define PG_WAIT_BUFFERPIN          0x04000000U
+#define PG_WAIT_BUFFER             0x04000000U
 #define PG_WAIT_ACTIVITY           0x05000000U
 #define PG_WAIT_CLIENT             0x06000000U
 #define PG_WAIT_EXTENSION          0x07000000U
index 668eedd71b2211d217a7fd069c14d5b45ff6812d..9cdf6cee8a7b376fdbdfcac5436795680524eb12 100644 (file)
@@ -194,7 +194,7 @@ $node_primary->poll_query_until(
    qq[
    SELECT count(*) >= 1 FROM pg_stat_activity
        WHERE pid = $vacuum_pid
-       AND wait_event = 'BufferPin';
+       AND wait_event = 'BufferCleanup';
    ],
    't');
 
index 3b37fafa65b9568fcc028fb901dd79cece40ad2d..0411db832f13f017727af6c078c3df0b51ab480f 100644 (file)
@@ -182,7 +182,7 @@ select type, count(*) > 0 as ok FROM pg_wait_events
    type    | ok 
 -----------+----
  Activity  | t
- BufferPin | t
+ Buffer    | t
  Client    | t
  Extension | t
  IO        | t
index abcb3c4c4cce30a6b4c772a6dc371559e3ec63c1..c1ad80a418d00bcb7a3014bb149e1992fe3eae4a 100644 (file)
@@ -3270,7 +3270,7 @@ WSANETWORKEVENTS
 WSAPROTOCOL_INFO
 WaitEvent
 WaitEventActivity
-WaitEventBufferPin
+WaitEventBuffer
 WaitEventClient
 WaitEventCustomCounterData
 WaitEventCustomEntryByInfo