loading libraries on Postmaster startup
От | Joe Conway |
---|---|
Тема | loading libraries on Postmaster startup |
Дата | |
Msg-id | 3E4B1BDC.405@joeconway.com обсуждение исходный текст |
Ответы |
Re: loading libraries on Postmaster startup
Re: loading libraries on Postmaster startup Re: loading libraries on Postmaster startup |
Список | pgsql-hackers |
While using PL/R in a web based application, I noticed that the library load and initialization time is significant enough to be annoying. So I wrote a quick hack to load and initialize the library on postmaster startup. This way, the backends get a fully initialized copy of the interpreter when they are forked. The hack was to postmaster.c just after the SSL initialization code at about line 650 (just remembered this is 7.3.2 though): if (true) /* later use startup GUC var */ { char *fullname = "$libdir/plr.so"; char *funcname = "start_interp"; func_ptr initfunc; initfunc = (func_ptr) load_external_function(fullname, funcname, true, NULL); (*initfunc)(); } (I also had to add a #define for func_ptr) This brings me to a couple questions: 1. Is there anything inherently dangerous with this approach? My light testing seems to show that it works quite wellfor my purpose. 2. It seems to me that other libraries such as those for PL/Tcl, PL/Perl, etc may have the same issue. Is there any meritin a GUC variable to allow libraries such as this to be loaded and initialized at postmaster start? I'll generalizethis and send in a patch if there is interest. Joe
В списке pgsql-hackers по дате отправления: