On Fri, Jan 2, 2009 at 20:20, Tom Lane <t...@sss.pgh.pa.us> wrote: > I wrote: >> * the startup/shutdown hooks will be installed in the postmaster >> process, but the patch expects them to be executed in a child process. >> I think nothing will happen. > > OK, I figured out what is happening there: the patch makes it work by > means of this expedient:
<snip> > I find this mighty Rube Goldbergian. We have a startup hook which is > declared in include/storage/ipc.h, but defined and called in bootstrap.c > (whence it will actually be executed down inside the startup process). > We have a shutdown hook which is also declared in include/storage/ipc.h, > but defined and called in bgwriter.c (executed in the bgwriter process, > of course). And to make those hooks work in the EXEC_BACKEND case, we > have a kluge inserted in proc.c, miles away from where the existing > process_shared_preload_libraries() calls are (in postmaster.c), and with > extremely high probability of someday resulting in duplicate preload > operations if the postmaster.c code gets shuffled. Kudos to Itagaki-san for getting that to work? > As for the shutdown hook, I don't think we need it at all in this > design. When loaded into the postmaster process, pg_stat_statements can > insert itself into the on_proc_exit or on_shmem_exit hook lists ... it > doesn't need a private hook. Ok cool. > The right way to make that happen is to rearrange the coding in > SubPostmasterMain() so that process_shared_preload_libraries is > done in all cases, just after the read_nondefault_variables call. This should also fix the rmg hooks patch on EXEC_BACKEND. -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers