From: | Thomas Munro <thomas(dot)munro(at)enterprisedb(dot)com> |
---|---|
To: | Alvaro Herrera <alvherre(at)2ndquadrant(dot)com> |
Cc: | Pg Hackers <pgsql-hackers(at)postgresql(dot)org>, Robert Haas <robertmhaas(at)gmail(dot)com> |
Subject: | Re: dsm.c API tweak |
Date: | 2017-03-25 02:40:51 |
Message-ID: | CAEepm=2c9ZLbGPayLi2AjSesaHixVt+QV2wN7cPLNgCxe7cSsw@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On Sat, Mar 25, 2017 at 1:59 PM, Thomas Munro
<thomas(dot)munro(at)enterprisedb(dot)com> wrote:
> On Sat, Mar 25, 2017 at 12:35 PM, Alvaro Herrera
> <alvherre(at)2ndquadrant(dot)com> wrote:
>> Alvaro Herrera wrote:
>>> Per
>>> https://postgr.es/m/CAEepm=11ma_Z1HoPxPcSCANnh5ykHORa=HcA1U1V1+5S_jwPuA@mail.gmail.com
>>> it seems that the dsm.c API is a bit inconvenient right now. I proposed
>>> in the first patch in that thread to change the API so that a segment is
>>> marked as "pinned" if created with no ResourceOwner set as current;
>>> which is essentially the same as creating a fake one, then marking the
>>> segment as pinned.
>>>
>>> Thomas agrees with me, so I propose this patch as preparatory work for
>>> the autovacuum/BRIN stuff I'm interested in.
>>
>> Here's the proposed patch.
>
> +1
- seg->resowner = CurrentResourceOwner;
- ResourceOwnerRememberDSM(CurrentResourceOwner, seg);
+ if (CurrentResourceOwner)
+ {
+ seg->resowner = CurrentResourceOwner;
+ ResourceOwnerRememberDSM(CurrentResourceOwner, seg);
+ }
You need to assign seg->resowner = CurrentResourceOwner
unconditionally here. Otherwise seg->resowner is uninitialised junk.
--
Thomas Munro
http://www.enterprisedb.com
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2017-03-25 03:01:19 | Re: WIP: Faster Expression Processing v4 |
Previous Message | Tomas Vondra | 2017-03-25 02:10:59 | crashes due to setting max_parallel_workers=0 |