diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2006-08-19 01:36:34 +0000 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2006-08-19 01:36:34 +0000 |
commit | 9bf760f7dec703aa34d9bd68aaa982943d24411e (patch) | |
tree | f36eed206a58dce384a76c27f77213a6444aaef7 /src/backend/storage/lmgr/lock.c | |
parent | 1be439084a380bc3f1576e2a2834839e508122dd (diff) |
Add a 'waiting' column to pg_stat_activity to carry the same information
that ps_status provides by appending 'waiting' to the PS display. This
completes the project of making it feasible to turn off process title
updates and instead rely on pg_stat_activity. Per my suggestion a few
weeks ago.
Diffstat (limited to 'src/backend/storage/lmgr/lock.c')
-rw-r--r-- | src/backend/storage/lmgr/lock.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/backend/storage/lmgr/lock.c b/src/backend/storage/lmgr/lock.c index 10049d593a0..7fe011a2baf 100644 --- a/src/backend/storage/lmgr/lock.c +++ b/src/backend/storage/lmgr/lock.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/storage/lmgr/lock.c,v 1.170 2006/07/31 20:09:05 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/storage/lmgr/lock.c,v 1.171 2006/08/19 01:36:28 tgl Exp $ * * NOTES * A lock table is a shared memory hash table. When @@ -36,6 +36,7 @@ #include "access/twophase.h" #include "access/twophase_rmgr.h" #include "miscadmin.h" +#include "pgstat.h" #include "storage/lmgr.h" #include "utils/memutils.h" #include "utils/ps_status.h" @@ -1114,6 +1115,7 @@ WaitOnLock(LOCALLOCK *locallock, ResourceOwner owner) LOCK_PRINT("WaitOnLock: sleeping on lock", locallock->lock, locallock->tag.mode); + /* Report change to waiting status */ if (update_process_title) { old_status = get_ps_display(&len); @@ -1123,7 +1125,8 @@ WaitOnLock(LOCALLOCK *locallock, ResourceOwner owner) set_ps_display(new_status, false); new_status[len] = '\0'; /* truncate off " waiting" */ } - + pgstat_report_waiting(true); + awaitedLock = locallock; awaitedOwner = owner; @@ -1160,11 +1163,13 @@ WaitOnLock(LOCALLOCK *locallock, ResourceOwner owner) awaitedLock = NULL; + /* Report change to non-waiting status */ if (update_process_title) { set_ps_display(new_status, false); pfree(new_status); } + pgstat_report_waiting(false); LOCK_PRINT("WaitOnLock: wakeup on lock", locallock->lock, locallock->tag.mode); |