Re: pre_load_libraries

From: Marc Munro <marc(at)bloodnok(dot)com>
To:
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: pre_load_libraries
Date: 2006-07-13 01:47:56
Message-ID: 1152755276.7928.107.camel@bloodnok.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Wed, 2006-07-12 at 02:18 -0300, I wrote:
> I am trying to create an initialisation function that is called using
> the preload_libraries option.
>
> The purpose of this is to set up shared memory for Veil, independant
> of postgres' own shared memory. Simple init functions work fine, but
> as soon as I place calls to ShemAlloc, or LWLockAssign, the server
> startup simply halts.

To answer my own question, yes I am being unreasonable. Shared memory
has not been set up at the time that process_preload_libraries is
called.

Since lwlocks are allocated from postgres shared memory, I cannot assign
an lwlock from Veil's initialisation code. Instead, I can make the
allocation of the lwlock the responsibility of the first session that
uses a Veil function but I need a lock to prevent a race.

My current thinking is to simply subvert one of the existing lwlocks
while I assign my own. A better solution from my point of view would be
to simply move the call to process_preload_libraries to a point after
shared memory has been set up. Is there some reason this could not be
done?

On a related note, I can see no way to release Veil's shared memory
segment when postgres is shut down. Perhaps I should be thinking about
making the management of such shared memory segments something that
postgres does on behalf of its add-ins, though that seems presumptious.

I'd appreciate any suggestions, pointers, random thoughts, etc.
__
Marc

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message ITAGAKI Takahiro 2006-07-13 01:49:33 Resurrecting per-page cleaner for btree
Previous Message Simon Riggs 2006-07-12 22:11:20 Re: Implied Functional Index use