aboutsummaryrefslogtreecommitdiff
path: root/src/backend/storage/buffer/bufmgr.c
diff options
context:
space:
mode:
authorRobert Haas <rhaas@postgresql.org>2016-03-10 12:44:09 -0500
committerRobert Haas <rhaas@postgresql.org>2016-03-10 12:44:09 -0500
commit53be0b1add7064ca5db3cd884302dfc3268d884e (patch)
tree913271b90f5a41778fe5bdbe2ac200c785dd6778 /src/backend/storage/buffer/bufmgr.c
parenta3a8309d450f7c4d1b743e84ba54ef5f7877d7be (diff)
downloadpostgresql-53be0b1add7064ca5db3cd884302dfc3268d884e.tar.gz
postgresql-53be0b1add7064ca5db3cd884302dfc3268d884e.zip
Provide much better wait information in pg_stat_activity.
When a process is waiting for a heavyweight lock, we will now indicate the type of heavyweight lock for which it is waiting. Also, you can now see when a process is waiting for a lightweight lock - in which case we will indicate the individual lock name or the tranche, as appropriate - or for a buffer pin. Amit Kapila, Ildus Kurbangaliev, reviewed by me. Lots of helpful discussion and suggestions by many others, including Alexander Korotkov, Vladimir Borodin, and many others.
Diffstat (limited to 'src/backend/storage/buffer/bufmgr.c')
-rw-r--r--src/backend/storage/buffer/bufmgr.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c
index 68cf5cc9f61..e8e0825eb0c 100644
--- a/src/backend/storage/buffer/bufmgr.c
+++ b/src/backend/storage/buffer/bufmgr.c
@@ -3351,6 +3351,9 @@ LockBufferForCleanup(Buffer buffer)
UnlockBufHdr(bufHdr);
LockBuffer(buffer, BUFFER_LOCK_UNLOCK);
+ /* Report the wait */
+ pgstat_report_wait_start(WAIT_BUFFER_PIN, 0);
+
/* Wait to be signaled by UnpinBuffer() */
if (InHotStandby)
{
@@ -3364,6 +3367,8 @@ LockBufferForCleanup(Buffer buffer)
else
ProcWaitForSignal();
+ pgstat_report_wait_end();
+
/*
* Remove flag marking us as waiter. Normally this will not be set
* anymore, but ProcWaitForSignal() can return for other signals as