Re: Native Windows, Apache Portable Runtime

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Cyril VELTER" <cyril(dot)velter(at)libertysurf(dot)fr>
Cc: "PostgreSQL-development" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Native Windows, Apache Portable Runtime
Date: 2002-05-06 13:36:02
Message-ID: 4739.1020692162@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

"Cyril VELTER" <cyril(dot)velter(at)libertysurf(dot)fr> writes:
> Are the PGShmemHeader fields only used by PGSharedMemoryCreate ?

Other than totalsize and freeoffset, I believe so. I see no reason
that a particular port couldn't stick different fields in there if it
had a mind to.

>> How does that solve the problem of determining whether a *previously*
>> created shmem block is still in use?

> Ok, I overlooked that, my proposal for PGSharedMemoryIsInUse doesn't
> make sense (and it doesn't matter on Beos because shared mem segments are
> automaticaly reaped at the end of the process).

Well, SharedMemoryIsInUse is *not* just about ensuring that the shared
memory gets reaped. The point is to ensure that you can't start a new
postmaster until the last old backend is gone. (Consider situations
where the parent postmaster process crashes, or perhaps is kill -9'd
by a careless DBA, but there are still active backends. We want to
detect that situation and ensure that a new postmaster will refuse to
start.)

>> How so? If those calls were needed before, why won't all three still
>> be needed?

> In the current hack, I've to iterate over all sharedmem segments (system
> wide) to find the original one by name. There is a race condition here if
> several backend are starting at the same time. beos_before_backend_startup
> beos_backend_startup_failed acquire / release a semaphore which prevent
> several fork at the same time.

Does keeping the shmem segment name around solve that? Seems like you
don't need a PGShmemHeader field for that; just store it in a static
variable.

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2002-05-06 13:40:36 Re: HEADS UP: Win32/OS2/BeOS native ports
Previous Message Christof Petig 2002-05-06 12:47:31 Re: [INTERFACES] ECPG: FETCH ALL|n FROM cursor - Memory allocation?