From: Tom Lane <tgl@sss.pgh.pa.us>
To: Robert Haas <robertmhaas@gmail.com>
Cc: Michael Paquier <michael@paquier.xyz>
Cc: Andres Freund <andres@anarazel.de>
Cc: Alvaro Herrera <alvherre@2ndquadrant.com>
Cc: PostgreSQL Hackers <pgsql-hackers@postgresql.org>
Subject: Re: TopoSort() fix
Date: Tue, 30 Jul 2019 13:36:36 -0400
Message-ID: <27546.1564508196@sss.pgh.pa.us> (raw)
In-Reply-To: <CA+TgmobUiYFpdX2=FErkT7gmu9FsL3_CgU35wfRb+WecVMLktw@mail.gmail.com>
References: <CAEri+mKtZkj=+phnkkD9_8sf1fLFUqwHio8Ls4f7JGVgqku6QQ@mail.gmail.com>
<20190726220538.GA17809@alvherre.pgsql>
<20190726234835.xqyfukqhhzdiqoih@alap3.anarazel.de>
<17997.1564187056@sss.pgh.pa.us>
<20190729015059.GE6959@paquier.xyz>
<23797.1564412165@sss.pgh.pa.us>
<CA+Tgmob7Hj9kDcULJUPv7mNw9KwXpVkwe9TXw_fxQrDWWbb_sA@mail.gmail.com>
<3243.1564437314@sss.pgh.pa.us>
<CA+TgmoaUQ+XvS+3U3GBsprSqUq1PBXk2RU_cbSopj2q+GFO=Lw@mail.gmail.com>
<13215.1564451308@sss.pgh.pa.us>
<CA+TgmobX+8Hj9Q-yREEqZGDjeMLAvKoSPt8jEs6Tc55VjVxgsg@mail.gmail.com>
<11847.1564496844@sss.pgh.pa.us>
<CA+TgmobUiYFpdX2=FErkT7gmu9FsL3_CgU35wfRb+WecVMLktw@mail.gmail.com>
Robert Haas <robertmhaas@gmail.com> writes:
> On Tue, Jul 30, 2019 at 10:27 AM Tom Lane <tgl@sss.pgh.pa.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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-hackers@postgresql.org
Cc: tgl@sss.pgh.pa.us, robertmhaas@gmail.com, michael@paquier.xyz, andres@anarazel.de, alvherre@2ndquadrant.com
Subject: Re: TopoSort() fix
In-Reply-To: <27546.1564508196@sss.pgh.pa.us>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox