Fix autovacuum for shared relations
authorAlvaro Herrera <alvherre@alvh.no-ip.org>
Tue, 10 May 2016 19:23:54 +0000 (16:23 -0300)
committerAlvaro Herrera <alvherre@alvh.no-ip.org>
Tue, 10 May 2016 19:23:54 +0000 (16:23 -0300)
commit15739393e4c3b64b9038d75784e848a415827517
tree31ad7dc157668ec644d306e216c6c45a8db6dd38
parent8ee29a19d69ab6c19ec0f7565541b9f96e898200
Fix autovacuum for shared relations

The table-skipping logic in autovacuum would fail to consider that
multiple workers could be processing the same shared catalog in
different databases.  This normally wouldn't be a problem: firstly
because autovacuum workers not for wraparound would simply ignore tables
in which they cannot acquire lock, and secondly because most of the time
these tables are small enough that even if multiple for-wraparound
workers are stuck in the same catalog, they would be over pretty
quickly.  But in cases where the catalogs are severely bloated it could
become a problem.

Backpatch all the way back, because the problem has been there since the
beginning.

Reported by Ondřej Světlík

Discussion: https://www.postgresql.org/message-id/572B63B1.3030603%40flexibee.eu
https://www.postgresql.org/message-id/572A1072.5080308%40flexibee.eu
src/backend/postmaster/autovacuum.c