summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorRobert Haas <rhaas@postgresql.org>2012-07-26 09:18:32 -0400
committerRobert Haas <rhaas@postgresql.org>2012-07-26 09:19:03 -0400
commitd7318d43d891bd63e82dcfc27948113ed7b1db80 (patch)
treef1c0e4e800a20cf8cdd22bfba189b3b64ad9da86 /src
parent4da8fc05f0a7a8b08d7ba43658bd952a54376611 (diff)
Log a better message when canceling autovacuum.
The old message was at DEBUG2, so typically it didn't show up in the log at all. As a result, in most cases where autovacuum was canceled, the only information that was logged was the table being vacuumed, with no indication as to what problem caused the cancel. Crank up the level to LOG and add some more details to assist with debugging. Back-patch all the way, per discussion on pgsql-hackers.
Diffstat (limited to 'src')
-rw-r--r--src/backend/storage/lmgr/proc.c25
1 files changed, 21 insertions, 4 deletions
diff --git a/src/backend/storage/lmgr/proc.c b/src/backend/storage/lmgr/proc.c
index 0df562b3064..78ad5a29f25 100644
--- a/src/backend/storage/lmgr/proc.c
+++ b/src/backend/storage/lmgr/proc.c
@@ -1086,12 +1086,29 @@ ProcSleep(LOCALLOCK *locallock, LockMethod lockMethodTable)
!(autovac_pgxact->vacuumFlags & PROC_VACUUM_FOR_WRAPAROUND))
{
int pid = autovac->pid;
+ StringInfoData locktagbuf;
+ StringInfoData logbuf; /* errdetail for server log */
+
+ initStringInfo(&locktagbuf);
+ initStringInfo(&logbuf);
+ DescribeLockTag(&locktagbuf, &lock->tag);
+ appendStringInfo(&logbuf,
+ _("Process %d waits for %s on %s"),
+ MyProcPid,
+ GetLockmodeName(lock->tag.locktag_lockmethodid,
+ lockmode),
+ locktagbuf.data);
+
+ /* release lock as quickly as possible */
+ LWLockRelease(ProcArrayLock);
- elog(DEBUG2, "sending cancel to blocking autovacuum PID %d",
- pid);
+ ereport(LOG,
+ (errmsg("sending cancel to blocking autovacuum PID %d",
+ pid),
+ errdetail_log("%s", logbuf.data)));
- /* don't hold the lock across the kill() syscall */
- LWLockRelease(ProcArrayLock);
+ pfree(logbuf.data);
+ pfree(locktagbuf.data);
/* send the autovacuum worker Back to Old Kent Road */
if (kill(pid, SIGINT) < 0)