!(autovac->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)