Content-Length: 304254 | pFad | http://github.com/postgrespro/postgres/commit/d7318d43d891bd63e82dcfc27948113ed7b1db80

8D Log a better message when canceling autovacuum. · postgrespro/postgres@d7318d4 · GitHub
Skip to content

Commit d7318d4

Browse files
committed
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.
1 parent 4da8fc0 commit d7318d4

File tree

1 file changed

+21
-4
lines changed
  • src/backend/storage/lmgr

1 file changed

+21
-4
lines changed

src/backend/storage/lmgr/proc.c

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1086,12 +1086,29 @@ ProcSleep(LOCALLOCK *locallock, LockMethod lockMethodTable)
10861086
!(autovac_pgxact->vacuumFlags & PROC_VACUUM_FOR_WRAPAROUND))
10871087
{
10881088
int pid = autovac->pid;
1089+
StringInfoData locktagbuf;
1090+
StringInfoData logbuf; /* errdetail for server log */
1091+
1092+
initStringInfo(&locktagbuf);
1093+
initStringInfo(&logbuf);
1094+
DescribeLockTag(&locktagbuf, &lock->tag);
1095+
appendStringInfo(&logbuf,
1096+
_("Process %d waits for %s on %s"),
1097+
MyProcPid,
1098+
GetLockmodeName(lock->tag.locktag_lockmethodid,
1099+
lockmode),
1100+
locktagbuf.data);
1101+
1102+
/* release lock as quickly as possible */
1103+
LWLockRelease(ProcArrayLock);
10891104

1090-
elog(DEBUG2, "sending cancel to blocking autovacuum PID %d",
1091-
pid);
1105+
ereport(LOG,
1106+
(errmsg("sending cancel to blocking autovacuum PID %d",
1107+
pid),
1108+
errdetail_log("%s", logbuf.data)));
10921109

1093-
/* don't hold the lock across the kill() syscall */
1094-
LWLockRelease(ProcArrayLock);
1110+
pfree(logbuf.data);
1111+
pfree(locktagbuf.data);
10951112

10961113
/* send the autovacuum worker Back to Old Kent Road */
10971114
if (kill(pid, SIGINT) < 0)

0 commit comments

Comments
 (0)








ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: http://github.com/postgrespro/postgres/commit/d7318d43d891bd63e82dcfc27948113ed7b1db80

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy