summaryrefslogtreecommitdiff
path: root/src/backend/access/transam/parallel.c
diff options
context:
space:
mode:
authorRobert Haas <rhaas@postgresql.org>2016-10-04 10:50:13 -0400
committerRobert Haas <rhaas@postgresql.org>2016-10-04 11:01:42 -0400
commit6f3bd98ebfc008cbd676da777bb0b2376c4c4bfa (patch)
tree4c35196ea76ee80c7df5e44b1959f2d1a4624437 /src/backend/access/transam/parallel.c
parent490ed1ebb9b26fb342a1e3240107092e9c5aec02 (diff)
downloadpostgresql-6f3bd98ebfc008cbd676da777bb0b2376c4c4bfa.tar.gz
Extend framework from commit 53be0b1ad to report latch waits.
WaitLatch, WaitLatchOrSocket, and WaitEventSetWait now taken an additional wait_event_info parameter; legal values are defined in pgstat.h. This makes it possible to uniquely identify every point in the core code where we are waiting for a latch; extensions can pass WAIT_EXTENSION. Because latches were the major wait primitive not previously covered by this patch, it is now possible to see information in pg_stat_activity on a large number of important wait events not previously addressed, such as ClientRead, ClientWrite, and SyncRep. Unfortunately, many of the wait events added by this patch will fail to appear in pg_stat_activity because they're only used in background processes which don't currently appear in pg_stat_activity. We should fix this either by creating a separate view for such information, or else by deciding to include them in pg_stat_activity after all. Michael Paquier and Robert Haas, reviewed by Alexander Korotkov and Thomas Munro.
Diffstat (limited to 'src/backend/access/transam/parallel.c')
-rw-r--r--src/backend/access/transam/parallel.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/backend/access/transam/parallel.c b/src/backend/access/transam/parallel.c
index cde0ed300f..59dc3949d8 100644
--- a/src/backend/access/transam/parallel.c
+++ b/src/backend/access/transam/parallel.c
@@ -24,6 +24,7 @@
#include "libpq/pqmq.h"
#include "miscadmin.h"
#include "optimizer/planmain.h"
+#include "pgstat.h"
#include "storage/ipc.h"
#include "storage/sinval.h"
#include "storage/spin.h"
@@ -540,7 +541,8 @@ WaitForParallelWorkersToFinish(ParallelContext *pcxt)
if (!anyone_alive)
break;
- WaitLatch(&MyProc->procLatch, WL_LATCH_SET, -1);
+ WaitLatch(&MyProc->procLatch, WL_LATCH_SET, -1,
+ WAIT_EVENT_PARALLEL_FINISH);
ResetLatch(&MyProc->procLatch);
}