Re: Dynamic Shared Memory stuff

Поиск
Список
Период
Сортировка
От Robert Haas
Тема Re: Dynamic Shared Memory stuff
Дата
Msg-id CA+TgmoZjMFGhL_F2fsnDRm25iTuXYCR=Kb2a83=vcca2w-gxuA@mail.gmail.com
обсуждение исходный текст
Ответ на Re: Dynamic Shared Memory stuff  (Amit Kapila <amit.kapila16@gmail.com>)
Ответы Re: Dynamic Shared Memory stuff  (Amit Kapila <amit.kapila16@gmail.com>)
Список pgsql-hackers
On Sat, Apr 12, 2014 at 1:32 AM, Amit Kapila <amit.kapila16@gmail.com> wrote:
> On Wed, Apr 9, 2014 at 9:20 PM, Robert Haas <robertmhaas@gmail.com> wrote:
>> On Wed, Apr 9, 2014 at 7:41 AM, Amit Kapila <amit.kapila16@gmail.com> wrote:
>>> I am just not sure whether it is okay to rearrange the code and call
>>> GetLastError() only if returned handle is Invalid (NULL) or try to look
>>> for more info.
>>
>> Well, I don't know either.  You wrote the Windows portion of this
>> code, so you'll have to decide what's best.  If the best practice in
>> this area is to only call GetLastError() if the handle isn't valid,
>> then that's probably what we should do, too.  But I can't speak to
>> what the best practice is.
>
> 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.

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?

-- 
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company



В списке pgsql-hackers по дате отправления:

Предыдущее
От: Andres Freund
Дата:
Сообщение: Re: Signaling of waiting for a cleanup lock?
Следующее
От: Robert Haas
Дата:
Сообщение: Re: [PATCH] Negative Transition Aggregate Functions (WIP)