On Sat, Mar 25, 2017 at 1:59 PM, Thomas Munro <thomas.mu...@enterprisedb.com> wrote: > On Sat, Mar 25, 2017 at 12:35 PM, Alvaro Herrera > <alvhe...@2ndquadrant.com> wrote: >> Alvaro Herrera wrote: >>> Per >>> https://postgr.es/m/CAEepm=11ma_Z1HoPxPcSCANnh5ykHORa=hca1u1v1+5s_jw...@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 -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers