From d4116a771925379c33cf4c6634ca620ed08b551d Mon Sep 17 00:00:00 2001 From: Robert Haas Date: Fri, 7 Apr 2017 13:41:47 -0400 Subject: [PATCH] Add ProcArrayGroupUpdate wait event. Discussion: http://postgr.es/m/CA+TgmobgWHcXDcChX2+BqJDk2dkPVF85ZrJFhUyHHQmw8diTpA@mail.gmail.com --- doc/src/sgml/monitoring.sgml | 5 ++++- src/backend/postmaster/pgstat.c | 3 +++ src/backend/storage/ipc/procarray.c | 3 +++ src/include/pgstat.h | 1 + 4 files changed, 11 insertions(+), 1 deletion(-) diff --git a/doc/src/sgml/monitoring.sgml b/doc/src/sgml/monitoring.sgml index 9856968997..b16325d390 100644 --- a/doc/src/sgml/monitoring.sgml +++ b/doc/src/sgml/monitoring.sgml @@ -1232,7 +1232,7 @@ postgres 27093 0.0 0.0 30096 2752 ? Ss 11:34 0:00 postgres: ser Waiting in an extension. - IPC + IPC BgWorkerShutdown Waiting for background worker to shut down. @@ -1272,6 +1272,9 @@ postgres 27093 0.0 0.0 30096 2752 ? Ss 11:34 0:00 postgres: ser ParallelBitmapPopulate Waiting for the leader to populate the TidBitmap. + + ProcArrayGroupUpdate + Waiting for group leader to clear transaction id at transaction end. SafeSnapshot Waiting for a snapshot for a READ ONLY DEFERRABLE transaction. diff --git a/src/backend/postmaster/pgstat.c b/src/backend/postmaster/pgstat.c index 56a8bf2d17..3fb57f060c 100644 --- a/src/backend/postmaster/pgstat.c +++ b/src/backend/postmaster/pgstat.c @@ -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; diff --git a/src/backend/storage/ipc/procarray.c b/src/backend/storage/ipc/procarray.c index fb39bdc2f5..ebf6a92923 100644 --- a/src/backend/storage/ipc/procarray.c +++ b/src/backend/storage/ipc/procarray.c @@ -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); diff --git a/src/include/pgstat.h b/src/include/pgstat.h index e29397f25b..5e029c0f4e 100644 --- a/src/include/pgstat.h +++ b/src/include/pgstat.h @@ -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, -- 2.40.0