Re: rmgr hooks and contrib/rmgr_hook - Mailing list pgsql-hackers

From Simon Riggs
Subject Re: rmgr hooks and contrib/rmgr_hook
Date
Msg-id 1220348980.4371.316.camel@ebony.2ndQuadrant
Whole thread Raw
In response to Re: rmgr hooks and contrib/rmgr_hook  (ITAGAKI Takahiro <itagaki.takahiro@oss.ntt.co.jp>)
Responses Re: rmgr hooks and contrib/rmgr_hook  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
On Tue, 2008-09-02 at 18:30 +0900, ITAGAKI Takahiro wrote:
> Simon Riggs <simon@2ndQuadrant.com> wrote:
> 
> > > Why do we need to set rmgr_hook in _PG_init(), and add or mofify rmgrs
> > > in our hook functions?
> > 
> > If we modify RmgrTable in _PG_init() then we would have to have that
> > structure available in all backends, which was a stated objective to
> > avoid. We would still need a fast access data structure for the
> > XLogInsert() check, so the RmgrTable would just be wasted space in all
> > normal backends. In the patch, plugin is only called when we call
> > RmgrInitialize(), so the memory is malloc'd only when required.
> 
> Um? AFAICS RmgrTable is not accessed in XLogInsert unless we use WAL_DEBUG.

Exactly why I want to malloc it.

> I see that RmgrTable should be malloc'd when required,
> but there is another issue; when to load rmgr libraries.

> Rmgr objects are needed only in startup process during recovery.
> If we want to reduce resource consumption by rmgrs, I think it is
> better not to load rmgr libraries through shared_preload_libraries.
> We don't have to load rmgr libs if recovery is not needed or after recovery.
> 
> How about adding a new variable "recovery_preload_libaries" like as
> shared_preload_libraries? Rmgr libs in it are loaded only in startup
> process and only if recovery is needed.

Good point. If others agree, I will re-implement this way.

-- Simon Riggs           www.2ndQuadrant.comPostgreSQL Training, Services and Support



pgsql-hackers by date:

Previous
From: Simon Riggs
Date:
Subject: Re: Window functions patch v04 for the September commit fest
Next
From: Martijn van Oosterhout
Date:
Subject: Re: Question regarding the database page layout.