Re: PgFDW connection invalidation by ALTER SERVER/ALTER USER MAPPING

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Kyotaro HORIGUCHI <horiguchi(dot)kyotaro(at)lab(dot)ntt(dot)co(dot)jp>
Cc: ashutosh(dot)bapat(at)enterprisedb(dot)com, pgsql-hackers(at)postgresql(dot)org, Langote_Amit_f8(at)lab(dot)ntt(dot)co(dot)jp, fcs1(at)poczta(dot)onet(dot)pl
Subject: Re: PgFDW connection invalidation by ALTER SERVER/ALTER USER MAPPING
Date: 2017-07-17 20:09:04
Message-ID: 9897.1500322144@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs pgsql-hackers

Kyotaro HORIGUCHI <horiguchi(dot)kyotaro(at)lab(dot)ntt(dot)co(dot)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

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message K S, Sandhya (Nokia - IN/Bangalore) 2017-07-18 05:27:58 Re: [HACKERS] Postgres process invoking exit resulting in sh-QUIT core
Previous Message Thomas Munro 2017-07-17 19:35:48 Re: BUG #14691: Isolation failure in deferrable transaction concurrent with schema change

Browse pgsql-hackers by date

  From Date Subject
Next Message Mark Dilger 2017-07-17 20:17:54 Re: Something for the TODO list: deprecating abstime and friends
Previous Message Mark Dilger 2017-07-17 19:54:31 Re: Something for the TODO list: deprecating abstime and friends