Re: Dead code or buggy code?
От | Robert Haas |
---|---|
Тема | Re: Dead code or buggy code? |
Дата | |
Msg-id | CA+TgmoazxQ+6fbERKDgsC2wiB=v3YenCiC0yQtXH_rh=knrt9A@mail.gmail.com обсуждение исходный текст |
Ответ на | Dead code or buggy code? (Greg Stark <stark@mit.edu>) |
Ответы |
Re: Dead code or buggy code?
|
Список | pgsql-hackers |
On Wed, Sep 18, 2013 at 6:20 PM, Greg Stark <stark@mit.edu> wrote: > The following code is in the ProcSleep at proc.c:1138. > GetBlockingAutoVacuumPgproc() should presumably always return a vacuum > pgproc entry since the deadlock state says it's blocked by autovacuum. > But I'm not really familiar enough with this codepath to know whether > there's not a race condition here where it can sometimes return null. > The following code checks autovac != NULL but the PGXACT initializer > would have seg faulted if it returned NULL if that's possible. > > if (deadlock_state == DS_BLOCKED_BY_AUTOVACUUM && > allow_autovacuum_cancel) > { > PGPROC *autovac = GetBlockingAutoVacuumPgproc(); > PGXACT *autovac_pgxact = > &ProcGlobal->allPgXact[autovac->pgprocno]; > > LWLockAcquire(ProcArrayLock, LW_EXCLUSIVE); > > /* > * Only do it if the worker is not working to protect against Xid > * wraparound. > */ > if ((autovac != NULL) && > (autovac_pgxact->vacuumFlags & PROC_IS_AUTOVACUUM) && > !(autovac_pgxact->vacuumFlags & PROC_VACUUM_FOR_WRAPAROUND)) > { Hmm, yeah. I remember noticing this some time ago but never got around to fixing it. +1 for rearranging things there somehow. -- Robert Haas EnterpriseDB: http://www.enterprisedb.com The Enterprise PostgreSQL Company
В списке pgsql-hackers по дате отправления: