postgres.git / summary / log / commit / refs
commit a5bca2487244e48de1ece92d4c6a1ff330d5333c
Author: Robert Haas <rhaas@postgresql.org>
Date: Thu Jul 26 13:18:32 2012 +0000
First released in: 9.3.0, 8.3.20, 8.4.13, 9.0.9, 9.1.5, 9.2.0
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.
src/backend/storage/lmgr/proc.c | 25 +++++++++++++++++++++----
1 file changed, 21 insertions(+), 4 deletions(-)
diff --git a/src/backend/storage/lmgr/proc.c b/src/backend/storage/lmgr/proc.c
index 327f43bb352..1fd8f9bf9a4 100644
--- a/src/backend/storage/lmgr/proc.c
+++ b/src/backend/storage/lmgr/proc.c
@@ -1100,12 +1100,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)
[parent: ba98239dcacb]