On Mon, Jan 27, 2014 at 11:18 PM, Amit Langote <amitlangot...@gmail.com> wrote: > On Mon, Jan 13, 2014 at 2:50 PM, Amit Kapila <amit.kapil...@gmail.com> wrote: >> I have extended test (contrib) module dsm_demo such that now user >> can specify during dsm_demo_create the lifespan of segment. >> The values it can accept are 0 or 1. Default value is 0. >> 0 -- means segment will be accessible for session life time >> 1 -- means segment will be accessible for postmaster life time >> >> >> The behaviour is as below: >> Test -1 (Session life time) >> Session - 1 >> -- here it will create segment for session lifetime >> select dsm_demo_create('this message is from session-1', 0); >> dsm_demo_create >> ----------------- >> 827121111 >> >> Session - 2 >> ----------------- >> select dsm_demo_read(827121111); >> dsm_demo_read >> ---------------------------- >> this message is from session-1 >> (1 row) >> >> >> Session-1 >> \q >> >> Session-2 >> postgres=# select dsm_demo_read(827121111); >> dsm_demo_read >> --------------- >> >> (1 row) >> >> Conclusion of Test-1 : As soon as session which has created segment finished, >> the segment becomes non-accessible. >> >> >> Test -2 (Postmaster life time) >> Session - 1 >> -- here it will create segment for postmaster lifetime >> select dsm_demo_create('this message is from session-1', 1); >> dsm_demo_create >> ----------------- >> 827121111 >> >> Session - 2 >> ----------------- >> select dsm_demo_read(827121111); >> dsm_demo_read >> ---------------------------- >> this message is from session-1 >> (1 row) >> >> >> Session-1 >> \q >> >> Session-2 >> postgres=# select dsm_demo_read(827121111); >> dsm_demo_read >> --------------- >> this message is from session-1 >> (1 row) >> >> Conclusion of Test-2 : a. Segment is accessible for postmaster lifetime. >> b. if user restart server, segment is >> not accessible. >> >> > > Applied dsm_keep_segment_v1.patch and dsm_demo_v1.patch. > Got the following warning when I tried above example: > > postgres=# select dsm_demo_create('this message is from session-new', 1); > WARNING: dynamic shared memory leak: segment 1402373971 still referenced > WARNING: dynamic shared memory leak: segment 1402373971 still referenced > dsm_demo_create > ----------------- > 1402373971 > (1 row) > >
I see that PrintDSMLeakWarning() which emits this warning is for debugging. -- Amit -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers