From: | Marc Munro <marc(at)bloodnok(dot)com> |
---|---|
To: | tgl(at)sss(dot)pgh(dot)pa(dot)us |
Cc: | pgsql-hackers(at)postgresql(dot)org |
Subject: | New shared memory hooks proposal (was Re: pre_load_libraries) |
Date: | 2006-07-13 15:40:28 |
Message-ID: | 1152805228.18709.14.camel@bloodnok.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On Thu, 2006-07-13 at 01:13 -0300, Tom Lane wrote:
> Marc Munro <marc(at)bloodnok(dot)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?
That does sound like the right way to go. Here is my new proposal:
Add-ins register their requirement for shared memory using a new
function: RegisterShmemRequirement(char *context_name, int size). This
would be called by the init function called from
process_preload_libraries.
When shared memory is initialised, extra space is allocated for each
registered add-in. Each add-in's registered allocation is a separate
memory context identified by the context_name parameter provided during
registration.
Add-ins allocate shared memory from their own context using a new
function ShemAddinAlloc(), which adds the context_name parameter to the
normal ShemAlloc parameter list.
This would save add-ins from having to manage their own shared memory
segements while providing a degree of separation and isolation so that
one add-in could not exhaust the shared memory of another or of the
backend.
If this is acceptable, I think it is within my skill level to implement.
Comments?
__
Marc
From | Date | Subject | |
---|---|---|---|
Next Message | Bernd Helmle | 2006-07-13 15:44:59 | Re: Updateable views for 8.2 or 8.3? |
Previous Message | A.M. | 2006-07-13 15:33:15 | Re: Three weeks left until feature freeze |