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

From Amit Kapila
Subject Re: Dynamic Shared Memory stuff
Date
Msg-id CAA4eK1JhP9+rGMS77b8HEUz4MrLROdgon8xZMg1bAzfz83Pc2w@mail.gmail.com
Whole thread Raw
In response to Re: Dynamic Shared Memory stuff  (Robert Haas <robertmhaas@gmail.com>)
Responses Re: Dynamic Shared Memory stuff
List pgsql-hackers
On Mon, Apr 14, 2014 at 10:03 PM, Robert Haas <robertmhaas@gmail.com> wrote:
> On Sat, Apr 12, 2014 at 1:32 AM, Amit Kapila <amit.kapila16@gmail.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.

> 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()).

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



pgsql-hackers by date:

Previous
From: Amit Kapila
Date:
Subject: Re: PostgreSQL in Windows console and Ctrl-C
Next
From: Jim Nasby
Date:
Subject: Re: Clock sweep not caching enough B-Tree leaf pages?