pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Jim Nasby <Jim.Nasby@BlueTreble.com>
To: Kyotaro HORIGUCHI <horiguchi.kyotaro@lab.ntt.co.jp>
To: tgl@sss.pgh.pa.us
Cc: robertmhaas@gmail.com
Cc: os@ohmu.fi
Cc: pgsql-hackers@postgresql.org
Subject: Re: Show dropped users' backends in pg_stat_activity
Date: Tue, 22 Mar 2016 22:47:16 -0500
Message-ID: <56F211C4.6010103@BlueTreble.com> (raw)
In-Reply-To: <20160323.123541.203539504.horiguchi.kyotaro@lab.ntt.co.jp>
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>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-hackers>

On 3/22/16 10:35 PM, Kyotaro HORIGUCHI wrote:
>> Even if we maintained some interlock for a backend's login role identity,
>> >I hardly think it would be practical to e.g. lock during transient SET
>> >ROLE or security-definer-function-call operations.  So it's not like we
>> >can let the permissions system assume that a role OID being inquired about
>> >always matches a live entry in pg_authid.
> Even if blocking DROPs is not perfect for all cases,
> unconditionally allowing to DROP a role still doesn't seem proper
> behavior, especially for replication roles. And session logins
> seem to me to have enough reason to be treated differently than
> disguising as another role using SET ROLE or sec-definer.

There's probably a way this could be handled, since DROP ROLE is 
presumably a very uncommon operation. Perhaps something as simple as 
keeping a single OID in shared memory for the role about to be dropped. 
That would serialize role drops, but I doubt that matters.

> The attached patch blocks DROP ROLE for roles that own active
> sessions, and on the other hand prevents a session from being
> activated if the login role is concurrently dropped.

I think this is fine for now, but... what happens if you drop a role 
that's in use on a streaming replica? Does replay stall or do we just 
ignore it?

There should probably be some doc changes to go with the patch too, no?
-- 
Jim Nasby, Data Architect, Blue Treble Consulting, Austin TX
Experts in Analytics, Data Architecture and PostgreSQL
Data in Trouble? Get it in Treble! http://BlueTreble.com


-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers



view thread (14+ messages)  latest in thread

Message-ID: <56F211C4.6010103@BlueTreble.com>
Permalink:  ../56F211C4.6010103@BlueTreble.com/
Also on:    postgresql.org/message-id/56F211C4.6010103@BlueTreble.com

 · 

reply

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: Jim.Nasby@BlueTreble.com, horiguchi.kyotaro@lab.ntt.co.jp, tgl@sss.pgh.pa.us, robertmhaas@gmail.com, os@ohmu.fi
  Subject: Re: Show dropped users' backends in pg_stat_activity
  In-Reply-To: <56F211C4.6010103@BlueTreble.com>
  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> <56F211C4.6010103@BlueTreble.com>

* 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