Re: BUG #14941: Vacuum crashes

From: Andres Freund <andres(at)anarazel(dot)de>
To: "Bossart, Nathan" <bossartn(at)amazon(dot)com>
Cc: Michael Paquier <michael(at)paquier(dot)xyz>, Masahiko Sawada <sawada(dot)mshk(at)gmail(dot)com>, Robert Haas <robertmhaas(at)gmail(dot)com>, Lyes Ameddah <lyes(dot)amd(at)gmail(dot)com>, Tomas Vondra <tomas(dot)vondra(at)2ndquadrant(dot)com>, "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>, "pgsql-bugs(at)postgresql(dot)org" <pgsql-bugs(at)postgresql(dot)org>
Subject: Re: BUG #14941: Vacuum crashes
Date: 2018-03-31 00:19:46
Message-ID: 20180331001946.uie7elezusxes7qw@alap3.anarazel.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs pgsql-hackers

Hi,

On 2018-03-30 18:39:01 +0000, Bossart, Nathan wrote:
> I've noticed one more problem with ACCESS EXCLUSIVE. If an ACCESS
> EXCLUSIVE lock is held on a child relation of a partitioned table,
> an ANALYZE on the partitioned table will be blocked at
> acquire_inherited_sample_rows().
>
> static int
> acquire_inherited_sample_rows(Relation onerel, int elevel,
> HeapTuple *rows, int targrows,
> double *totalrows, double *totaldeadrows)
> {
> ...
> /*
> * Find all members of inheritance set. We only need AccessShareLock on
> * the children.
> */
> tableOIDs =
> find_all_inheritors(RelationGetRelid(onerel), AccessShareLock, NULL);

Right.

> It also seems possible for the call to vac_open_indexes() in
> do_analyze_rel() to block.

Yup.

> I think the most straightforward approach for fixing this is to add
> skip-locked functionality in find_all_inheritors(),
> find_inheritance_children(), and vac_open_indexes(), but I am curious
> what others think.

I'm actually wondering if we shouldn't just ignore this problem. While
the other cases VACUUM (SKIP LOCKED) are intended to solve seem common,
these seem less so. But it'd be a bit weird, too..

Could you post a rebased version of the patch, with an incremental
addition of what you propose in a separate patch?

Greetings,

Andres Freund

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message PG Bug reporting form 2018-04-02 10:36:45 BUG #15140: Incorrect jsonb_set behavoir
Previous Message Bruce Momjian 2018-03-30 20:52:29 Re: BUG #15112: Unable to run pg_upgrade with earthdistance extension

Browse pgsql-hackers by date

  From Date Subject
Next Message Tatsuo Ishii 2018-03-31 00:30:26 Re: [HACKERS] [PATCH] Lockable views
Previous Message Andres Freund 2018-03-31 00:09:42 Re: Change RangeVarGetRelidExtended() to take flags argument?