Re: Add callback in pgstats for backend initialization - Mailing list pgsql-hackers

From Kyotaro Horiguchi
Subject Re: Add callback in pgstats for backend initialization
Date
Msg-id 20240904.141543.1746675785869985842.horikyota.ntt@gmail.com
Whole thread Raw
In response to Re: Add callback in pgstats for backend initialization  (Bertrand Drouvot <bertranddrouvot.pg@gmail.com>)
List pgsql-hackers
At Tue, 3 Sep 2024 05:00:54 +0000, Bertrand Drouvot <bertranddrouvot.pg@gmail.com> wrote in 
> Hi,
> 
> On Tue, Sep 03, 2024 at 10:52:20AM +0900, Michael Paquier wrote:
> > Hi all,
> > 
> > Currently, the backend-level initialization of pgstats happens in
> > pgstat_initialize(), where we are using a shortcut for the WAL stats,
> > with pgstat_init_wal().
> > 
> > I'd like to propose to add a callback for that, so as in-core or
> > custom pgstats kinds can assign custom actions when initializing a
> > backend.  The use-case I had for this one are pretty close to what we
> > do for WAL, where we would rely on a difference of state depending on
> > what may have existed before reaching the initialization path.  So
> > this can offer more precision.  Another case, perhaps less
> > interesting, is to be able to initialize some static backend state.
> 
> I think the proposal makes sense and I can see the use cases too, so +1.

+1, too.

The name "init_backend" makes it sound like the function initializes
the backend. backend_init might be a better choice, but I'm not sure.

regards.

-- 
Kyotaro Horiguchi
NTT Open Source Software Center



pgsql-hackers by date:

Previous
From: Kyotaro Horiguchi
Date:
Subject: Re: Add callbacks for fixed-numbered stats flush in pgstats
Next
From: Bertrand Drouvot
Date:
Subject: Re: Add callbacks for fixed-numbered stats flush in pgstats