Unix Technical Forum

Re: pre_load_libraries

This is a discussion on Re: pre_load_libraries within the pgsql Hackers forums, part of the PostgreSQL category; --> On Wed, 2006-07-12 at 02:18 -0300, I wrote: > I am trying to create an initialisation function that is ...


Go Back   Unix Technical Forum > Database Server Software > PostgreSQL > pgsql Hackers

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 04-12-2008, 04:23 AM
Marc Munro
 
Posts: n/a
Default Re: pre_load_libraries

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

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.3 (GNU/Linux)

iD8DBQBEtaZMUBr6u+c2wkERAmQxAJ0c7nLvzOgCc61FjoEkAr 6vAbgrTwCePFec
yuxhai+fOBsq0cMVJFr2sVA=
=HAnb
-----END PGP SIGNATURE-----

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 04-12-2008, 04:23 AM
Tom Lane
 
Posts: n/a
Default Re: pre_load_libraries

Marc Munro <marc@bloodnok.com> writes:
> ... 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?


That would make it impossible for a preloaded library to request any
shared memory of its own --- something that admittedly we don't have a
hook to support, but do we want to foreclose it permanently?

regards, tom lane

---------------------------(end of broadcast)---------------------------
TIP 6: explain analyze is your friend

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 04-12-2008, 04:24 AM
Martijn van Oosterhout
 
Posts: n/a
Default Re: pre_load_libraries

On Wed, Jul 12, 2006 at 06:47:56PM -0700, Marc Munro wrote:
> 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.


The easiest way is to simply delete the shared memory segment after
you've done the shmat(). The shmat() will hold onto it until postgres
quits and then be cleaned up by the OS.

Have a nice day,
--
Martijn van Oosterhout <kleptog@svana.org> http://svana.org/kleptog/
> From each according to his ability. To each according to his ability to litigate.


-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (GNU/Linux)

iD8DBQFEtfMzIB7bNG8LQkwRAsjBAJ0RKNW9LAXfldwSGCvir0 kxx53UoACfVtRD
trVMgJ3mTRtGsmHSZXZf80Q=
=lXhx
-----END PGP SIGNATURE-----

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 08:00 PM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0
www.UnixAdminTalk.com