Re: vacuumdb parallel has a deadlock detected in 9.5.4

From: Francisco Olarte <folarte(at)peoplecall(dot)com>
To: Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>
Cc: hubert depesz lubaczewski <depesz(at)depesz(dot)com>, huang <foggyglass(at)163(dot)com>, "pgsql-bugs(at)postgresql(dot)org" <pgsql-bugs(at)postgresql(dot)org>
Subject: Re: vacuumdb parallel has a deadlock detected in 9.5.4
Date: 2016-09-29 07:57:58
Message-ID: CA+bJJbx8+SKBU=XUE+HxZHysh9226iMfTnA69AznwRTOEGtR7Q@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Hi:

On Wed, Sep 28, 2016 at 10:39 PM, Alvaro Herrera
<alvherre(at)2ndquadrant(dot)com> wrote:
>> > There is a error deadlock detected in vacuumdb parallel .
>> > but if I do not use parallel , it has not deadlock detected .
>> man vacuumdb says about -j option:
>>
>> >> Note that using this mode together with the -f (FULL) option might cause
>> >> deadlock failures if certain system catalogs are processed in parallel.
>> so, while I understand it's not pretty, it's well documented.
>
> Yeah. However I think this behavior is rather unhelpful. Maybe we
> should try to fix it somehow, but I'm not sure how. We could say that
> pg_catalog tables can only be processed one at a time, instead of trying
> to paralelize them? For example: have vacuumdb fill two lists of
> tables, one for pg_catalog and one for tables in other schemas. Each
> worker chooses a table from the pg_catalog list first if it's not empty
> and there's no other worker doing one of these, otherwise one from the
> other table.
>
> I think that'd fix it, while not destroying paralelizability too badly.

I would propose another behaviour, which I think can solve the problem
without introducing more complex code. Put a couple of flags to vacuum
only catalog tables / non catalog tables ( I believe this can be
served by include/exclude schemas too, which will be even more useful
for other things ). This way one can do a full paralell vacuum of
non-catalog objects followed by a serial one on catalog objects (
which should not be too slow on 'normal' databases ) ( I propose this
order because IIRC normal vacuum updates catalog tables so they get
vacuumed after to tidy them )

Francisco Olarte

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message David Rowley 2016-09-29 11:20:21 Re: BUG #14344: string_agg(DISTINCT ..) crash
Previous Message Michael Paquier 2016-09-29 07:55:49 Re: BUG #14243: pg_basebackup failes by a STATUS_DELETE_PENDING file