Re: [HACKERS] why do shmem attach? - Mailing list pgsql-hackers

From Tom Lane
Subject Re: [HACKERS] why do shmem attach?
Date
Msg-id 13909.937838950@sss.pgh.pa.us
Whole thread Raw
In response to Re: [HACKERS] why do shmem attach?  (Vadim Mikheev <vadim@krs.ru>)
List pgsql-hackers
Vadim Mikheev <vadim@krs.ru> writes:
> Tom Lane wrote:
>> Have I got a deal for you ;-).  I have uncommitted changes that add
>> a pointer (SHMEM_OFFSET that is) to each backend's PROC struct into
>> the per-backend info array that already existed in shmem.c.

> Nice. I have new member for PROC that should be searched
> sometime -:)

OK, cool.  Easy enough to add now.  The reason I did this was that
I added to PROC the OID of the database the backend is attached to,
so that I could make a routine to tell whether any running backends
are connected to a given database.  I couldn't quite stomach adding
yet another ShmemIndex-traverser to shmem.c, so...

(I'm sure you can see already where I'm going with that: DESTROY
DATABASE now refuses to destroy a database that has running backends.
I got burnt that way once too often.  The interlock against
halfway-started backends was a tad tricky, but I think it works.)
        regards, tom lane


pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: [HACKERS] why do shmem attach?
Next
From: Tom Lane
Date:
Subject: Re: [HACKERS] Status on Jan Wieck