pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Kyotaro HORIGUCHI <horiguchi.kyotaro@lab.ntt.co.jp>
Cc: ashutosh.bapat@enterprisedb.com
Cc: pgsql-hackers@postgresql.org
Cc: Langote_Amit_f8@lab.ntt.co.jp
Cc: fcs1@poczta.onet.pl
Subject: Re: PgFDW connection invalidation by ALTER SERVER/ALTER USER MAPPING
Date: Mon, 17 Jul 2017 16:09:04 -0400
Message-ID: <9897.1500322144@sss.pgh.pa.us> (raw)
In-Reply-To: <20170714.173424.239554763.horiguchi.kyotaro@lab.ntt.co.jp>
References: <20170713.134249.97825982.horiguchi.kyotaro@lab.ntt.co.jp>
	<20170713.182300.148193868.horiguchi.kyotaro@lab.ntt.co.jp>
	<CAFjFpRd0yz3v0rL2yxmr95e_iDntkeQia9709KXaHLyVcZ=_mQ@mail.gmail.com>
	<20170714.173424.239554763.horiguchi.kyotaro@lab.ntt.co.jp>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-hackers>

Kyotaro HORIGUCHI <horiguchi.kyotaro@lab.ntt.co.jp> writes:
> This is the revased and revised version of the previous patch.

A few more comments:

* Per the spec for CacheRegisterSyscacheCallback, a zero hash value means
to flush all associated state.  This isn't handling that case correctly.
Even when you are given a specific hash value, I think exiting after
finding one match is incorrect: there could be multiple connections
to the same server with different user mappings, or vice versa.

* I'm not really sure that it's worth the trouble to pay attention
to the hash value at all.  Very few other syscache callbacks do,
and the pg_server/pg_user_mapping catalogs don't seem likely to
have higher than average traffic.

* Personally I'd be inclined to register the callbacks at the same
time the hashtables are created, which is a pattern we use elsewhere
... in fact, postgres_fdw itself does it that way for the transaction
related callbacks, so it seems a bit weird that you are going in a
different direction for these callbacks.  That way avoids the need to
depend on a _PG_init function and means that the callbacks don't have to
worry about the hashtables not being valid.  Also, it seems a bit
pointless to have separate layers of postgresMappingSysCallback and
InvalidateConnectionForMapping functions.

* How about some regression test cases?  You couldn't really exercise
cross-session invalidation easily, but I don't think you need to.

			regards, tom lane


-- 
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 (16+ messages)  latest in thread

Message-ID: <9897.1500322144@sss.pgh.pa.us>
Permalink:  ../9897.1500322144@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/9897.1500322144@sss.pgh.pa.us

 · 

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-bugs@postgresql.org
  Cc: tgl@sss.pgh.pa.us, horiguchi.kyotaro@lab.ntt.co.jp, ashutosh.bapat@enterprisedb.com, pgsql-hackers@postgresql.org, Langote_Amit_f8@lab.ntt.co.jp, fcs1@poczta.onet.pl
  Subject: Re: PgFDW connection invalidation by ALTER SERVER/ALTER USER MAPPING
  In-Reply-To: <9897.1500322144@sss.pgh.pa.us>
  References: <20170713.134249.97825982.horiguchi.kyotaro@lab.ntt.co.jp> <20170713.182300.148193868.horiguchi.kyotaro@lab.ntt.co.jp> <CAFjFpRd0yz3v0rL2yxmr95e_iDntkeQia9709KXaHLyVcZ=_mQ@mail.gmail.com> <20170714.173424.239554763.horiguchi.kyotaro@lab.ntt.co.jp> <9897.1500322144@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