Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Create a distinct wait event for POSIX DSM allocation.
authorThomas Munro <tmunro@postgresql.org>
Thu, 14 Jul 2022 10:52:13 +0000 (22:52 +1200)
committerThomas Munro <tmunro@postgresql.org>
Thu, 14 Jul 2022 11:56:28 +0000 (23:56 +1200)
Previously we displayed "DSMFillZeroWrite" while in posix_fallocate(),
because we shared the same wait event for "mmap" and "posix" DSM types.
Let's introduce a new wait event "DSMAllocate", to be more accurate.

Reported-by: Andres Freund <andres@anarazel.de>
Discussion: https://postgr.es/m/20220711174518.yldckniicknsxgzl%40awork3.anarazel.de

doc/src/sgml/monitoring.sgml
src/backend/storage/ipc/dsm_impl.c
src/backend/utils/activity/wait_event.c
src/include/utils/wait_event.h

index 4549c2560e3fd6ee79cdceaf8b482012080b9f1f..f2066e5f0f51ea68002a4fde706a7b4068a360a4 100644 (file)
@@ -1296,6 +1296,11 @@ postgres   27093  0.0  0.0  30096  2752 ?        Ss   11:34   0:00 postgres: ser
       <entry><literal>CopyFileWrite</literal></entry>
       <entry>Waiting for a write during a file copy operation.</entry>
      </row>
+     <row>
+      <entry><literal>DSMAllocate</literal></entry>
+      <entry>Waiting for a dynamic shared memory segment to be
+       allocated.</entry>
+     </row>
      <row>
       <entry><literal>DSMFillZeroWrite</literal></entry>
       <entry>Waiting to fill a dynamic shared memory backing file with
index 6f21a757758f327bf77646dbf8d9774b541fd4ac..258d47bcfacf6ea1da6a7de90f6a3e428e7eecb3 100644 (file)
@@ -364,7 +364,7 @@ dsm_impl_posix_resize(int fd, off_t size)
     */
    PG_SETMASK(&BlockSig);
 
-   pgstat_report_wait_start(WAIT_EVENT_DSM_FILL_ZERO_WRITE);
+   pgstat_report_wait_start(WAIT_EVENT_DSM_ALLOCATE);
 #if defined(HAVE_POSIX_FALLOCATE) && defined(__linux__)
    /*
     * On Linux, a shm_open fd is backed by a tmpfs file.  If we were to use
index 87c15b9c6f38e0c636d550e1d3cbea920ec6da0b..da57a93034e1a7ec8feca7756213ffe1f1d7a50d 100644 (file)
@@ -585,6 +585,9 @@ pgstat_get_wait_io(WaitEventIO w)
        case WAIT_EVENT_DATA_FILE_WRITE:
            event_name = "DataFileWrite";
            break;
+       case WAIT_EVENT_DSM_ALLOCATE:
+           event_name = "DSMAllocate";
+           break;
        case WAIT_EVENT_DSM_FILL_ZERO_WRITE:
            event_name = "DSMFillZeroWrite";
            break;
index b578e2ec7573ac1fd6ad09509f328bfb8092ccbd..c3ade0112063c981585c5dd4b8d54036c1858c80 100644 (file)
@@ -178,6 +178,7 @@ typedef enum
    WAIT_EVENT_DATA_FILE_SYNC,
    WAIT_EVENT_DATA_FILE_TRUNCATE,
    WAIT_EVENT_DATA_FILE_WRITE,
+   WAIT_EVENT_DSM_ALLOCATE,
    WAIT_EVENT_DSM_FILL_ZERO_WRITE,
    WAIT_EVENT_LOCK_FILE_ADDTODATADIR_READ,
    WAIT_EVENT_LOCK_FILE_ADDTODATADIR_SYNC,