From: Stephen Frost <sfrost@snowman.net>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: Robert Haas <robertmhaas@gmail.com>
Cc: Kyotaro HORIGUCHI <horiguchi.kyotaro@lab.ntt.co.jp>
Cc: Oskari Saarenmaa <os@ohmu.fi>
Cc: pgsql-hackers@postgresql.org <pgsql-hackers@postgresql.org>
Subject: Re: Show dropped users' backends in pg_stat_activity
Date: Thu, 24 Mar 2016 22:33:47 -0400
Message-ID: <20160325023347.GZ3127@tamriel.snowman.net> (raw)
In-Reply-To: <3577.1458835419@sss.pgh.pa.us>
References: <56E87CD8.60007@ohmu.fi>
<CA+TgmoabAtxUpdG7XX3fXoVZef=Miy6Q2=_Ng-nGCfvzBgdbkw@mail.gmail.com>
<16068.1458143290@sss.pgh.pa.us>
<20160323.123541.203539504.horiguchi.kyotaro@lab.ntt.co.jp>
<CA+TgmoYeN+MDgGPXYJPYoBqttsTWkPw7TEAMtTz5nmiawmD6zA@mail.gmail.com>
<3577.1458835419@sss.pgh.pa.us>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-hackers>
* Tom Lane (tgl@sss.pgh.pa.us) wrote:
> Robert Haas <robertmhaas@gmail.com> writes:
> > I am not really in favor of half-fixing this. If we can't
> > conveniently wait until a dropped role is completely out of the
> > system, then I don't see a lot of point in trying to do it in the
> > limited cases where we can. If LEFT JOIN is the way to go, then,
> > blech, but, so be it.
>
> I concur. Let's put the left join(s) into those views and call it
> good.
I'd suggest we also add some notes to the documentation that the correct
approach to dropping users is to disallow access first, then kill any
existing backends, and then drop the user. That, plus the left joins,
seems like it's good enough.
> BTW, I think we would need the left joins even if we had interlocking
> in DROP, just to protect ourselves against race conditions. Remember
> that what pg_stat_activity shows is a snapshot, which might be more or
> less out of date compared to the catalog contents.
True, though that would likely be a much smaller set of cases that might
also be short lived.
Might be good to also note in the docs how to kill off sessions which
are regular users but which no longer have a username, for folks who end
up in this situation that they managed to drop a role which still had
connections to the system.
Thanks!
Stephen
Attachments:
signature.asc (application/pgp-signature, 818B) download
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 from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-hackers@postgresql.org
Cc: sfrost@snowman.net, tgl@sss.pgh.pa.us, robertmhaas@gmail.com, horiguchi.kyotaro@lab.ntt.co.jp, os@ohmu.fi
Subject: Re: Show dropped users' backends in pg_stat_activity
In-Reply-To: <20160325023347.GZ3127@tamriel.snowman.net>
References: <56E87CD8.60007@ohmu.fi> <CA+TgmoabAtxUpdG7XX3fXoVZef=Miy6Q2=_Ng-nGCfvzBgdbkw@mail.gmail.com> <16068.1458143290@sss.pgh.pa.us> <20160323.123541.203539504.horiguchi.kyotaro@lab.ntt.co.jp> <CA+TgmoYeN+MDgGPXYJPYoBqttsTWkPw7TEAMtTz5nmiawmD6zA@mail.gmail.com> <3577.1458835419@sss.pgh.pa.us> <20160325023347.GZ3127@tamriel.snowman.net>
* 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