Re: Dynamic Shared Memory stuff

From: Robert Haas <robertmhaas(at)gmail(dot)com>
To: Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>
Cc: Noah Misch <noah(at)leadboat(dot)com>, 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-04-15 21:31:35
Message-ID: CA+TgmoYm4+QWQy1u4oLXX0GFHKOVWFMgVsmrpC4pvT1b=MqhJg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Tue, Apr 15, 2014 at 12:33 AM, Amit Kapila <amit(dot)kapila16(at)gmail(dot)com> wrote:
> On Mon, Apr 14, 2014 at 10:03 PM, Robert Haas <robertmhaas(at)gmail(dot)com> wrote:
>> On Sat, Apr 12, 2014 at 1:32 AM, Amit Kapila <amit(dot)kapila16(at)gmail(dot)com> wrote:
>>> I have checked that other place in code also check handle to
>>> decide if API has failed. Refer function PGSharedMemoryIsInUse().
>>> So I think fix to call GetLastError() after checking handle is okay.
>>> Attached patch fixes this issue. After patch, the server shows below
>>> log which is exactly what is expected from test_shm_mq
>>
>> In PostgreSQL code, hmap == NULL, rather than !hmap, is the preferred
>> way to test for a NULL pointer. I notice that the !hmap style is used
>> throughout this code, so I guess cleaning that up is a matter for a
>> separate commit.
>
> I think in that case we might want to cleanup some other similar usage
> (PGSharedMemoryCreate) of !hmap.

Ah. Well, in that case maybe we should just leave it alone, since
it's been like that forever and nobody's cared until now.

>> For the create case, I'm wondering if we should put the block that
>> tests for !hmap *before* the _dosmaperr() and check for EEXIST. What
>> is your opinion?
>
> Either way is okay, but I think the way you are suggesting is better as it
> will make code consistent with other place (PGSharedMemoryCreate()).

OK, can you prepare a patch?

--
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 Josh Berkus 2014-04-15 21:47:51 How can we make beta testing better?
Previous Message Josh Berkus 2014-04-15 21:25:37 Need Multixact Freezing Docs