Re: Retain dynamic shared memory segments for postmaster lifetime

From: Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>
To: Robert Haas <robertmhaas(at)gmail(dot)com>
Cc: Kyotaro HORIGUCHI <horiguchi(dot)kyotaro(at)lab(dot)ntt(dot)co(dot)jp>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Retain dynamic shared memory segments for postmaster lifetime
Date: 2014-03-10 16:44:15
Message-ID: CAA4eK1+NmB_vKUF7QcUBBR49DAMgM_uHk79gUO_Vn4187MkK5g@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Mon, Mar 10, 2014 at 9:48 PM, Amit Kapila <amit(dot)kapila16(at)gmail(dot)com> wrote:
> On Mon, Mar 10, 2014 at 8:18 PM, Robert Haas <robertmhaas(at)gmail(dot)com> wrote:
>> I took a look at this patch. It seems to me that it doesn't do a very
>> good job maintaining the abstraction boundary between what the dsm.c
>> layer knows about and what the dsm_impl.c layer knows about. However,
>> AFAICS, these problems are purely cosmetic, so I took a crack at
>> fixing them. I retitled the new implementation-layer function to
>> dsm_impl_keep_segment(), swapped the order of the arguments for
>> consistency with other code, adjusted the dsm_impl.c code slightly to
>> avoid assuming that only the Windows implementation works on Windows
>> (that's currently true, but we could probably make the mmap
>> implementation work there as well), and retooled some of the comments
>> to read better in English. I'm happy with the attached version but
>> don't have a Windows box to test it there.
>
> Thank you for looking into patch. I have verified that attached patch
> works fine on Windows.
>
> One observation in new version of patch:
>
> + {
> + char name[64];
> +
> + snprintf(name, 64, "%s.%u", SEGMENT_NAME_PREFIX, handle);
> + _dosmaperr(GetLastError());
> + ereport(ERROR,
> + (errcode_for_dynamic_shared_memory(),
> + errmsg("could not duplicate handle: %m")));
> + }

I have updated the patch to change message as below:
errmsg("could not duplicate handle for \"%s\": %m",
name)));

Let me know your suggestions?

With Regards,
Amit Kapila.
EnterpriseDB: http://www.enterprisedb.com

Attachment Content-Type Size
dsm_keep_segment_v5.patch application/octet-stream 4.5 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Jeff Janes 2014-03-10 16:54:36 Re: pg_upgrade on high number tables database issues
Previous Message Amit Kapila 2014-03-10 16:18:56 Re: Retain dynamic shared memory segments for postmaster lifetime