more-autovac-cancel-logging.patch
application/octet-stream
Filename: more-autovac-cancel-logging.patch
Type: application/octet-stream
Part: 0
Message:
Re: canceling autovacuum task woes
Patch
Same data as JSON:
GET /api/v1/attachments/:id/patch
the parsed metadata as JSON — format, series position, per-file stats; never the diff bytes.
API reference →
Format: context
| File | + | − |
|---|---|---|
| src/backend/storage/lmgr/proc.c | 22 | 0 |
*** a/src/backend/storage/lmgr/proc.c
--- b/src/backend/storage/lmgr/proc.c
***************
*** 39,44 ****
--- 39,45 ----
#include "access/twophase.h"
#include "access/xact.h"
#include "miscadmin.h"
+ #include "pgstat.h"
#include "postmaster/autovacuum.h"
#include "replication/syncrep.h"
#include "storage/ipc.h"
***************
*** 1086,1097 **** ProcSleep(LOCALLOCK *locallock, LockMethod lockMethodTable)
!(autovac_pgxact->vacuumFlags & PROC_VACUUM_FOR_WRAPAROUND))
{
int pid = autovac->pid;
! elog(DEBUG2, "sending cancel to blocking autovacuum PID %d",
! pid);
! /* don't hold the lock across the kill() syscall */
! LWLockRelease(ProcArrayLock);
/* send the autovacuum worker Back to Old Kent Road */
if (kill(pid, SIGINT) < 0)
--- 1087,1115 ----
!(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);
! ereport(LOG,
! (errmsg("sending cancel to blocking autovacuum PID %d",
! pid),
! errdetail_log("%s", logbuf.data)));
! pfree(logbuf.data);
! pfree(locktagbuf.data);
/* send the autovacuum worker Back to Old Kent Road */
if (kill(pid, SIGINT) < 0)