Add ProcArrayGroupUpdate wait event.
authorRobert Haas <[email protected]>
Fri, 7 Apr 2017 17:41:47 +0000 (13:41 -0400)
committerRobert Haas <[email protected]>
Fri, 7 Apr 2017 17:41:47 +0000 (13:41 -0400)
Discussion: http://postgr.es/m/CA+TgmobgWHcXDcChX2+BqJDk2dkPVF85ZrJFhUyHHQmw8diTpA@mail.gmail.com

doc/src/sgml/monitoring.sgml
src/backend/postmaster/pgstat.c
src/backend/storage/ipc/procarray.c
src/include/pgstat.h

index 9856968997e84f2f7d8caf421e87e227b9670599..b16325d39004a064b46b4078ee212e65eb50cb84 100644 (file)
@@ -1232,7 +1232,7 @@ postgres   27093  0.0  0.0  30096  2752 ?        Ss   11:34   0:00 postgres: ser
          <entry>Waiting in an extension.</entry>
         </row>
         <row>
-         <entry morerows="11"><literal>IPC</></entry>
+         <entry morerows="12"><literal>IPC</></entry>
          <entry><literal>BgWorkerShutdown</></entry>
          <entry>Waiting for background worker to shut down.</entry>
         </row>
@@ -1272,6 +1272,9 @@ postgres   27093  0.0  0.0  30096  2752 ?        Ss   11:34   0:00 postgres: ser
          <entry><literal>ParallelBitmapPopulate</></entry>
          <entry>Waiting for the leader to populate the TidBitmap.</entry>
         </row>
+        <row>
+         <entry><literal>ProcArrayGroupUpdate</></entry>
+         <entry>Waiting for group leader to clear transaction id at transaction end.</entry>
         <row>
          <entry><literal>SafeSnapshot</></entry>
          <entry>Waiting for a snapshot for a <literal>READ ONLY DEFERRABLE</> transaction.</entry>
index 56a8bf2d17f7582554128b4cfe1df9ddf955887b..3fb57f060c95cbbb24a72dd85c1e6026de96458e 100644 (file)
@@ -3560,6 +3560,9 @@ pgstat_get_wait_ipc(WaitEventIPC w)
                case WAIT_EVENT_PARALLEL_BITMAP_SCAN:
                        event_name = "ParallelBitmapScan";
                        break;
+               case WAIT_EVENT_PROCARRAY_GROUP_UPDATE:
+                       event_name = "ProcArrayGroupUpdate";
+                       break;
                case WAIT_EVENT_SAFE_SNAPSHOT:
                        event_name = "SafeSnapshot";
                        break;
index fb39bdc2f598f2af15ebbca8d8f77348472f7702..ebf6a9292391a860e766992fb13189ae758c1363 100644 (file)
@@ -53,6 +53,7 @@
 #include "access/xlog.h"
 #include "catalog/catalog.h"
 #include "miscadmin.h"
+#include "pgstat.h"
 #include "storage/proc.h"
 #include "storage/procarray.h"
 #include "storage/spin.h"
@@ -513,6 +514,7 @@ ProcArrayGroupClearXid(PGPROC *proc, TransactionId latestXid)
                int                     extraWaits = 0;
 
                /* Sleep until the leader clears our XID. */
+               pgstat_report_wait_start(WAIT_EVENT_PROCARRAY_GROUP_UPDATE);
                for (;;)
                {
                        /* acts as a read barrier */
@@ -521,6 +523,7 @@ ProcArrayGroupClearXid(PGPROC *proc, TransactionId latestXid)
                                break;
                        extraWaits++;
                }
+               pgstat_report_wait_end();
 
                Assert(pg_atomic_read_u32(&proc->procArrayGroupNext) == INVALID_PGPROCNO);
 
index e29397f25b83202b7e1a037d6b9371e913512fa3..5e029c0f4ef490a0a8d693de25d39571d4700474 100644 (file)
@@ -808,6 +808,7 @@ typedef enum
        WAIT_EVENT_MQ_SEND,
        WAIT_EVENT_PARALLEL_FINISH,
        WAIT_EVENT_PARALLEL_BITMAP_SCAN,
+       WAIT_EVENT_PROCARRAY_GROUP_UPDATE,
        WAIT_EVENT_SAFE_SNAPSHOT,
        WAIT_EVENT_SYNC_REP,
        WAIT_EVENT_LOGICAL_SYNC_DATA,