Re: Reconcile stats in find_tabstat_entry() and get rid of PgStat_BackendFunctionEntry

From: "Drouvot, Bertrand" <bertranddrouvot(dot)pg(at)gmail(dot)com>
To: Kyotaro Horiguchi <horikyota(dot)ntt(at)gmail(dot)com>
Cc: andres(at)anarazel(dot)de, pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Re: Reconcile stats in find_tabstat_entry() and get rid of PgStat_BackendFunctionEntry
Date: 2023-02-13 08:58:52
Message-ID: e4fe4710-09ff-2d74-9680-b63f4b46ebf9@gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

On 2/13/23 8:40 AM, Kyotaro Horiguchi wrote:
> At Mon, 13 Feb 2023 08:09:50 +0100, "Drouvot, Bertrand" <bertranddrouvot(dot)pg(at)gmail(dot)com> wrote in
>>> I think this is useful beyond being able to generate those functions
>>> with
>>> macros. The fact that we had to deal with transactional code in
>>> pgstatfuncs.c
>>> meant that a lot of the relevant itnernals had to be exposed "outside"
>>> pgstat,
>>> which seems architecturally not great.
>>>
>> Right, good point.
>
> Agreed.
>
>> Removing the pfrees in V2 attached.
>
> Ah, that sound good.
>
> if (!entry_ref)
> + {
> entry_ref = pgstat_fetch_pending_entry(PGSTAT_KIND_RELATION, InvalidOid, rel_id);
> + return tablestatus;
> + }
>
> We should return something if the call returns a non-null value?

What we do is: if entry_ref is NULL then we return NULL (so that the caller returns 0).

If entry_ref is not NULL then we return a copy of entry_ref->pending (with or without subtrans).

>
> So, since we want to hide the internal from pgstatfuncs, the
> additional flag should be gone.

I think there is pros and cons for both but I don't have a strong opinion about that.

So also proposing V3 attached without the flag in case this is the preferred approach.

Regards,

--
Bertrand Drouvot
PostgreSQL Contributors Team
RDS Open Source Databases
Amazon Web Services: https://aws.amazon.com

Attachment Content-Type Size
v3-0001-find_tabstat_entry_recon.patch text/plain 3.4 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Drouvot, Bertrand 2023-02-13 09:06:27 Get rid of PgStat_BackendFunctionEntry
Previous Message Peter Smith 2023-02-13 08:52:49 Re: Time delayed LR (WAS Re: logical replication restrictions)