Re: Parallel worker error

From: Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>
To: Robert Haas <robertmhaas(at)gmail(dot)com>
Cc: Noah Misch <noah(at)leadboat(dot)com>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Pavan Deolasee <pavan(dot)deolasee(at)gmail(dot)com>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Parallel worker error
Date: 2017-09-08 05:17:20
Message-ID: CAA4eK1KG9Du5G9D8g8z6eL2adsdAC6t0Vw-ofaJdGfu73zpcGQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Fri, Sep 8, 2017 at 3:18 AM, Robert Haas <robertmhaas(at)gmail(dot)com> wrote:
> On Mon, Sep 4, 2017 at 5:46 AM, Amit Kapila <amit(dot)kapila16(at)gmail(dot)com> wrote:
>> It seems like the consensus is to move forward with this approach. I
>> have written a patch implementing the above idea. Note, that to use
>> SetCurrentRoleId, we need the value of guc "is_superuser" for the
>> current user and we don't pass this value to parallel workers as this
>> is PGC_INTERNAL guc variable. So, I have passed this value via
>> FixedParallelState.
>
>
> With your patch, the order is wrong. SetCurrentRoleId() is called
> AFTER SetUserIdAndSecContext(). Furthermore, the role ID passed to
> SetCurrentRoleId() is always the same one passed to
> SetUserIdAndSecContext(). But those roles might be different.
> fps->current_user_id is set by a call to GetUserIdAndSecContext(),
> which reads CurrentUserId, not OuterUserId. I think you need to pass
> the value returned by GetCurrentRoleId() as an additional element of
> FixedParallelState.
>

You are right. I have changed the ordering and passed OuterUserId via
FixedParallelState.

--
With Regards,
Amit Kapila.
EnterpriseDB: http://www.enterprisedb.com

Attachment Content-Type Size
fix_role_handling_parallel_worker_v2.patch application/octet-stream 5.7 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Fabien COELHO 2017-09-08 05:25:10 Re: psql: new help related to variables are not too readable
Previous Message Pavel Stehule 2017-09-08 04:57:18 Re: psql: new help related to variables are not too readable