Re: Win32 shmem

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Magnus Hagander <magnus(at)hagander(dot)net>
Cc: pgsql-patches <pgsql-patches(at)postgresql(dot)org>
Subject: Re: Win32 shmem
Date: 2007-03-20 01:46:31
Message-ID: 2510.1174355191@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-patches

Magnus Hagander <magnus(at)hagander(dot)net> writes:
> Attached is a first attempt at a "native win32 shmem implementatio",
> based on previous discussions. Instead of emulating the sysv stuff. The
> base stuff (using mapped pagefile) is still the same, of course.

> Needs more testing, but has survived my tests so far. And unlike the
> previous implementation, it does properly refuse to start a second
> postmaster in a data directory where there is one or more backends still
> running.

That's good...

> Does it seem like I've overlooked anything obvious in this? I do get the
> feeling that this is too simple, but I don't know exactly where the
> problem is :-)

I think you do still need the on_shmem_exit detach callback. Consider
the situation where the postmaster is trying to reinitialize after a
child crash. The Unix code is designed to detach and destroy the old
segment then create a new one. If that's not what you want to do then
this code still seems not right.

The coding of GetShareMemName seems involuted. I'd normally expect
success exit to be at the bottom of the routine, not deeply nested
like this. You may be saving one elog(FATAL) call this way, but
I'd argue that the two cases could do with different message texts
anyway. (Also, GetSharedMemName seems to read better.)

There seem to be a lot of system calls not checked for failure here.
Do they really not have any failure possibilities?

> errdetail("Failed system call was MapViewOfFileEx", size, szShareMem)));

Doesn't your compiler validate sprintf arguments?

I trust the committed file isn't going to have DOS line endings.

regards, tom lane

In response to

  • Win32 shmem at 2007-03-19 18:35:59 from Magnus Hagander

Responses

Browse pgsql-patches by date

  From Date Subject
Next Message Neil Conway 2007-03-20 02:48:00 Re: bgwriter stats
Previous Message Darcy Buskermolen 2007-03-20 00:51:05 Re: bgwriter stats