diff options
author | Robert Haas <rhaas@postgresql.org> | 2016-03-10 12:44:09 -0500 |
---|---|---|
committer | Robert Haas <rhaas@postgresql.org> | 2016-03-10 12:44:09 -0500 |
commit | 53be0b1add7064ca5db3cd884302dfc3268d884e (patch) | |
tree | 913271b90f5a41778fe5bdbe2ac200c785dd6778 /src/backend/access/transam/xact.c | |
parent | a3a8309d450f7c4d1b743e84ba54ef5f7877d7be (diff) |
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/access/transam/xact.c')
-rw-r--r-- | src/backend/access/transam/xact.c | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/src/backend/access/transam/xact.c b/src/backend/access/transam/xact.c index b491735d2e2..ab8758661db 100644 --- a/src/backend/access/transam/xact.c +++ b/src/backend/access/transam/xact.c @@ -2447,13 +2447,14 @@ AbortTransaction(void) */ LWLockReleaseAll(); + /* Clear wait information and command progress indicator */ + pgstat_report_wait_end(); + pgstat_progress_end_command(); + /* Clean up buffer I/O and buffer context locks, too */ AbortBufferIO(); UnlockBuffers(); - /* Clear command progress indicator */ - pgstat_progress_end_command(); - /* Reset WAL record construction state */ XLogResetInsertion(); @@ -4541,9 +4542,10 @@ AbortSubTransaction(void) */ LWLockReleaseAll(); + pgstat_report_wait_end(); + pgstat_progress_end_command(); AbortBufferIO(); UnlockBuffers(); - pgstat_progress_end_command(); /* Reset WAL record construction state */ XLogResetInsertion(); @@ -4653,6 +4655,9 @@ AbortSubTransaction(void) */ XactReadOnly = s->prevXactReadOnly; + /* Report wait end here, when there is no further possibility of wait */ + pgstat_report_wait_end(); + RESUME_INTERRUPTS(); } |