Re: Dynamic Shared Memory stuff - Mailing list pgsql-hackers

From Robert Haas
Subject Re: Dynamic Shared Memory stuff
Date
Msg-id CA+Tgmoa9FW-uG+gFUeEUSU0eZ7J6ky7kLg-6nC71TCMoO7kV9Q@mail.gmail.com
Whole thread Raw
In response to Re: Dynamic Shared Memory stuff  (Noah Misch <noah@leadboat.com>)
Responses Re: Dynamic Shared Memory stuff
List pgsql-hackers
On Tue, Jan 21, 2014 at 2:58 PM, Noah Misch <noah@leadboat.com> wrote:
>> What do people prefer?
>
> I recommend performing cleanup on the control segment named in PGShmemHeader
> just before shmdt() in PGSharedMemoryCreate().  No new ERROR or WARNING sites
> are necessary.  Have dsm_postmaster_startup() continue to perform a cleanup on
> the control segment named in the state file.

I think I'm on board with the first two sentences of this, but after
Fujii Masao's email yesterday, I can't help thinking that what you
propose the third sentence is a bad idea.  He cloned a master to
create a standby server on the same machine, and the standby startup
ate the master's dynamic shared memory.  We could teach pg_basebackup
not to copy the state file, but that wouldn't help people who take
base backups using the file system copy method, which is a lot of
people.

>> 5. Give up on this approach.  We could keep what we have now, or make
>> the DSM control segment land at a well-known address as we do for the
>> main segment.
>
> How would having the DSM control segment at a well-known address affect the
> problem at hand?  Did you mean a well-known dsm_handle?

Yeah.  So the idea is that we'd always use a dsm_handle of 1000000 +
(100 * port) or something like that, and then search forward until we
find a dsm_handle that works.  This is basically the same algorithm
we're using today for the main shared memory segment, but with a large
additive constant so that they don't collide with each other.

-- 
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company



pgsql-hackers by date:

Previous
From: Robert Haas
Date:
Subject: Re: ALTER SYSTEM SET typos and fix for temporary file name management
Next
From: Amit Kapila
Date:
Subject: Re: [bug fix] pg_ctl always uses the same event source