Re: TopoSort() fix

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Robert Haas <robertmhaas(at)gmail(dot)com>
Cc: Michael Paquier <michael(at)paquier(dot)xyz>, Andres Freund <andres(at)anarazel(dot)de>, Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: TopoSort() fix
Date: 2019-07-30 17:36:36
Message-ID: 27546.1564508196@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Robert Haas <robertmhaas(at)gmail(dot)com> writes:
> On Tue, Jul 30, 2019 at 10:27 AM Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
>> (BTW, why aren't these functions just "parallel restricted"?)

> ...
> But it is really pretty arguable whether we should feel responsible
> for that problem. We could just decide that if you're doing that, and
> you don't want the scenario described above to happen, you oughta mark
> the function that contains this logic at least PARALLEL RESTRICTED,
> and if you don't, then it's your fault for doing a dumb thing. I
> believe when we were early on in the development of this we wanted to
> be very conservative lest, ah, someone accuse us of not locking things
> down well enough, but maybe at this point parallel query is a
> sufficiently well-established concept that we should lighten up on
> some cases where we took an overly-stringent line. If we take that
> view, then I'm not sure why these functions couldn't be just marked
> PARALLEL SAFE.

No, there's a sufficient reason why we should force advisory locks
to be taken in the leader process, namely that the behavior is totally
different if we don't: they will disappear at the end of the parallel
worker run, not at end of transaction or session as documented.

However, that argument doesn't seem to be a reason why the advisory-lock
functions couldn't be parallel-restricted rather than parallel-unsafe.

In any case, my question at the moment is whether we need the belt-and-
suspenders-too approach of having both non-parallel-safe marking and an
explicit check inside these functions. We've largely moved away from
hard-wired checks for e.g. superuserness, and surely these things are
less dangerous than most formerly-superuser-only functions.

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Robert Haas 2019-07-30 17:38:19 Re: Attached partition not considering altered column properties of root partition.
Previous Message Tom Lane 2019-07-30 17:27:48 Re: Avoid full GIN index scan when possible