Re: Autovacuum of pg_database - Mailing list pgsql-admin

From Tom Lane
Subject Re: Autovacuum of pg_database
Date
Msg-id 4352.1462833746@sss.pgh.pa.us
Whole thread Raw
In response to Re: Autovacuum of pg_database  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: Autovacuum of pg_database  (Bob Lunney <blunney@meetme.com>)
Re: Autovacuum of pg_database  (Alvaro Herrera <alvherre@2ndquadrant.com>)
Re: Autovacuum of pg_database  (Ondřej Světlík <osvetlik@flexibee.eu>)
List pgsql-admin
I wrote:
> Alvaro Herrera <alvherre@2ndquadrant.com> writes:
>> Now that I actually tried this, it turned out that this problem is not
>> so simple.  vacuum.c already has logic to use conditional acquire of the
>> table-level lock, and if not available it skips the table:
>> LOG:  skipping vacuum of "pg_shdepend" --- lock not available
>> so an autovacuum worker is never "stuck" behind another worker trying to
>> vacuum the table.

> Hmm ... but then, how do we have the observed symptom of several workers
> concurrently trying to process the same shared catalog?  Seems like all
> but one should fall out at this point.

Oh, see table_recheck_autovac:

        tab->at_vacoptions = VACOPT_SKIPTOAST |
            (dovacuum ? VACOPT_VACUUM : 0) |
            (doanalyze ? VACOPT_ANALYZE : 0) |
            (!wraparound ? VACOPT_NOWAIT : 0);
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

I'll bet they're all trying to do anti-wraparound vacuums.  This would
explain why the problem hasn't been observed often enough to have been
fixed long since.

            regards, tom lane


pgsql-admin by date:

Previous
From: Tom Lane
Date:
Subject: Re: Autovacuum of pg_database
Next
From: "drum.lucas@gmail.com"
Date:
Subject: toast tables