pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Heikki Linnakangas <hlinnakangas@vmware.com>
To: Noah Misch <noah@leadboat.com>
Cc: Robert Haas <robertmhaas@gmail.com>
Cc: Tom Lane <tgl@sss.pgh.pa.us>
Cc: Andres Freund <andres@2ndquadrant.com>
Cc: Andrew Dunstan <andrew@dunslane.net>
Cc: pgsql-hackers@postgresql.org <pgsql-hackers@postgresql.org>
Subject: Re: Something fishy happening on frogmouth
Date: Mon, 04 Nov 2013 10:27:47 +0200
Message-ID: <52775A83.7090206@vmware.com> (raw)
In-Reply-To: <20131101162230.GA649568@tornado.leadboat.com>
References: <20131030133718.GB11429@awork2.anarazel.de>
	<28492.1383140966@sss.pgh.pa.us>
	<CA+TgmobOqYVBD=xdWHF12R4+dxeBDS3ruxware7ZWtD5mfSO5Q@mail.gmail.com>
	<527223E8.2020207@vmware.com>
	<20131031095021.GA31628@alap2.anarazel.de>
	<CA+Tgmoa6gJAPeMKCK77xzUbhqriO0C+24Ow7ezz4GP8wHCF-EA@mail.gmail.com>
	<22875.1383229757@sss.pgh.pa.us>
	<CA+Tgmobk7nL8MAQdOVPTHzn2pA7aP-kfYvjHTqUsZnbu3FsOxQ@mail.gmail.com>
	<5272EC6A.2020004@vmware.com>
	<CA+TgmoZhFZkdywhCwu-kB9CdrPz_gZ6scSjSjBpjE3W4FPAu=g@mail.gmail.com>
	<20131101162230.GA649568@tornado.leadboat.com>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-hackers>

On 01.11.2013 18:22, Noah Misch wrote:
> On Fri, Nov 01, 2013 at 12:27:31AM -0400, Robert Haas wrote:
>> On Thu, Oct 31, 2013 at 7:48 PM, Heikki Linnakangas <hlinnakangas@vmware.com> wrote:
>>> On 31.10.2013 16:43, Robert Haas wrote:
>>>> There should be no cases where the main shared memory
>>>> segment gets cleaned up and the dynamic shared memory segments do not.
>>>
>>> 1. initdb -D data1
>>> 2. initdb -D data2
>>> 3. postgres -D data1
>>> 4. killall -9 postgres
>>> 5. postgres -D data2
>>>
>>> The system V shmem segment orphaned at step 4 will be cleaned up at step 5.
>>> The DSM segment will not.
>
> Note that dynamic_shared_memory_type='mmap' will give the desired behavior.

Hmm, here's another idea:

Postmaster creates the POSIX shared memory object at startup, by calling 
shm_open(), and immediately calls shm_unlink on it. That way, once all 
the processes have exited, the object will be removed automatically. 
Child processes inherit the file descriptor at fork(), and don't need to 
call shm_open, just mmap().

I'm not sure how dynamic these segments need to be, but if 1-2 such file 
descriptors is not enough, you could mmap() different offsets from the 
same shmem object for different segments.

- Heikki


-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers



view thread (38+ messages)  latest in thread

Message-ID: <52775A83.7090206@vmware.com>
Permalink:  ../52775A83.7090206@vmware.com/
Also on:    postgresql.org/message-id/52775A83.7090206@vmware.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-hackers@postgresql.org
  Cc: hlinnakangas@vmware.com, noah@leadboat.com, robertmhaas@gmail.com, tgl@sss.pgh.pa.us, andres@2ndquadrant.com, andrew@dunslane.net
  Subject: Re: Something fishy happening on frogmouth
  In-Reply-To: <52775A83.7090206@vmware.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox