Re: Dynamic Shared Memory stuff

From: Robert Haas <robertmhaas(at)gmail(dot)com>
To: Noah Misch <noah(at)leadboat(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Heikki Linnakangas <hlinnakangas(at)vmware(dot)com>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Dynamic Shared Memory stuff
Date: 2014-01-22 14:32:09
Message-ID: CA+Tgmoa9FW-uG+gFUeEUSU0eZ7J6ky7kLg-6nC71TCMoO7kV9Q@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Tue, Jan 21, 2014 at 2:58 PM, Noah Misch <noah(at)leadboat(dot)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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Amit Kapila 2014-01-22 14:37:59 Re: [bug fix] pg_ctl always uses the same event source
Previous Message Robert Haas 2014-01-22 14:15:01 Re: ALTER SYSTEM SET typos and fix for temporary file name management