Re: Using user mapping OID as hash key for connection hash

From: Robert Haas <robertmhaas(at)gmail(dot)com>
To: Ashutosh Bapat <ashutosh(dot)bapat(at)enterprisedb(dot)com>
Cc: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Using user mapping OID as hash key for connection hash
Date: 2016-01-28 17:20:04
Message-ID: CA+TgmoZ+dQHYUw8v3FSXQpzM9rwRWX1pCb8io-f=ioZsT=LD2Q@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Wed, Jan 27, 2016 at 6:32 AM, Ashutosh Bapat
<ashutosh(dot)bapat(at)enterprisedb(dot)com> wrote:
> As discussed in postgres_fdw join pushdown thread [1], for two different
> effective local users which use public user mapping we will be creating two
> different connections to the foreign server with the same credentials.
>
> Robert suggested [2] that we should use user mapping OID as the connection
> cache key instead of current userid and serverid.
>
> There are two patches attached here:
> 1. pg_fdw_concache.patch.short - shorter version of the fix. Right now
> ForeignTable, ForeignServer have corresponding OIDs saved in these
> structures. But UserMapping doesn't. Patch adds user mapping OID as a member
> to this structure. This member is then used as key in GetConnection().
> 2. pg_fdw_concache.patch.large - most of the callers of GetConnection() get
> ForeignServer object just to pass it to GetConnection(). GetConnection can
> obtain ForeignServer by using serverid from UserMapping and doesn't need
> ForeignServer to be an argument. Larger version of patch has this change.

The long form seems like a good idea, so I committed that one.

--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Tomas Vondra 2016-01-28 17:31:47 Re: Template for commit messages
Previous Message Stefan Kaltenbrunner 2016-01-28 17:16:31 Re: HEADSUP: gitmaster.postgresql.org - upgrade NOW