Re: Dynamic Shared Memory stuff

From: Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>
To: Robert Haas <robertmhaas(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 04:33:21
Message-ID: CAA4eK1JhP9+rGMS77b8HEUz4MrLROdgon8xZMg1bAzfz83Pc2w@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

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.

> 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

In response to

Responses

Browse pgsql-hackers by date

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