Re: [BUGS] Patch to allow C extension modules to initialize/finish

From: Gregory Stark <gsstark(at)mit(dot)edu>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Joe Conway <mail(at)joeconway(dot)com>, David Fetter <david(at)fetter(dot)org>, rse(at)engelschall(dot)com, pgsql-hackers(at)postgresql(dot)org
Subject: Re: [BUGS] Patch to allow C extension modules to initialize/finish
Date: 2006-08-04 23:31:00
Message-ID: 87mzakqdsb.fsf@stark.xeocode.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs pgsql-hackers

Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> writes:

> No, my thought is that you'd rename PL/R's init function to PG_init, and
> then it'd get called automagically without needing to assume that the DBA
> remembers to specify it in preload_libraries. If there's a reason *not*
> to do that then it'd be a strike against this whole proposal, methinks.

If I understand the question correctly it hinges on whether you want to do all
the initialization pre-fork or post-fork? I'm pretty sure you have to allow
for both possibilities.

I know when I was using mod_perl heavily we wanted to load as many perl
modules and code pre-fork as possible. The more we loaded pre-fork the more
memory was shared across processes and the more processes we could run on a
box without suffering from memory pressure.

On the other side the classic case of something that cannot be set up pre-fork
is actually database connections :) So, for example if for someone wanted to
have a persistent Oracle connection they could not open it pre-fork at library
load time but they might want to open it immediately after the fork rather
than when it's first used.

--
Gregory Stark
EnterpriseDB http://www.enterprisedb.com

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2006-08-05 01:10:04 Re: [BUGS] Patch to allow C extension modules to initialize/finish
Previous Message Kris Jurka 2006-08-04 17:31:00 Re: BUG #2559: why jdbc-driver AbstractJdbc2ResultSetMetaData.

Browse pgsql-hackers by date

  From Date Subject
Next Message Lukas Smith 2006-08-04 23:50:43 Re: 8.2 features status
Previous Message David Fetter 2006-08-04 22:44:28 Re: 8.2 features status