pg.ddx.io  pgsql-patches@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Simon Riggs <simon@2ndQuadrant.com>
To: ITAGAKI Takahiro <itagaki.takahiro@oss.ntt.co.jp>
Cc: List pgsql-patches <pgsql-patches@postgresql.org>
Subject: Re: rmgr hooks and contrib/rmgr_hook
Date: Tue, 02 Sep 2008 09:44:24 +0100
Message-ID: <1220345064.4371.275.camel@ebony.2ndQuadrant> (raw)
In-Reply-To: <20080901121833.4A18.52131E4D@oss.ntt.co.jp>
References: <1220174867.4371.107.camel@ebony.2ndQuadrant>
	<20080901121833.4A18.52131E4D@oss.ntt.co.jp>


On Mon, 2008-09-01 at 12:42 +0900, ITAGAKI Takahiro wrote:
> Simon Riggs <simon@2ndQuadrant.com> wrote:
> 
> > 1) A refactoring of calls to Rmgr code from xlog.c, and having isolated
> > the code for rmgrs then to allow rmgr plugins to modify and/or add rmgrs
> > to Postgres. Includes additional code to generate log messages so we can
> > see what is happening after plugin has executed.
> 
> Why do we need to set rmgr_hook in _PG_init(), and add or mofify rmgrs
> in our hook functions? I think it is possible to modify RmgrTable
> directly in _PG_init() instead of to have rmgr_hook. If we can do so,
> the patch would be more simple, no? Am I missing something?

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.

The other reason is that this way of doing things is common to most
other server hooks. It allows the loaded module to specify that there
will be a plugin, but for the server to determine when that is called.
Calling code at the time _PG_init() runs limits us to certain types of
activity.

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




view thread (23+ messages)  latest in thread

Message-ID: <1220345064.4371.275.camel@ebony.2ndQuadrant>
Permalink:  ../1220345064.4371.275.camel@ebony.2ndQuadrant/
Also on:    postgresql.org/message-id/1220345064.4371.275.camel@ebony.2ndQuadrant

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-patches@postgresql.org
  Cc: simon@2ndQuadrant.com, itagaki.takahiro@oss.ntt.co.jp
  Subject: Re: rmgr hooks and contrib/rmgr_hook
  In-Reply-To: <1220345064.4371.275.camel@ebony.2ndQuadrant>
  References: <1220174867.4371.107.camel@ebony.2ndQuadrant> <20080901121833.4A18.52131E4D@oss.ntt.co.jp> <1220345064.4371.275.camel@ebony.2ndQuadrant>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox