Re: [Proposal] Expose internal MultiXact member count function for efficient monitoring

From: Michael Paquier <michael(at)paquier(dot)xyz>
To: Naga Appani <nagnrik(at)gmail(dot)com>
Cc: Ashutosh Bapat <ashutosh(dot)bapat(dot)oss(at)gmail(dot)com>, Kirill Reshke <reshkekirill(at)gmail(dot)com>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: [Proposal] Expose internal MultiXact member count function for efficient monitoring
Date: 2025-08-18 06:49:41
Message-ID: aKLNBdQc-tCFMszs@paquier.xyz
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Sun, Aug 17, 2025 at 01:27:29AM -0500, Naga Appani wrote:
> On Thu, Aug 7, 2025 at 7:35 PM Michael Paquier <michael(at)paquier(dot)xyz> wrote:
>>
>> I really think that we should move the SQL function parts of multixact.c
>> into their own new file, exposing ReadMultiXactCounts() in multixact.h...
>
> Done. The SQL-callable code now lives in
> src/backend/utils/adt/multixactfuncs.c
> and the accessor is declared in
> src/include/access/multixact.h.

My point was a bit different: multixactfuncs.c should be created first
because we already have one SQL function in multixact.c that can be
moved inside it, with the declarations it requires added to
multixact.h. I've extracted what you did, moved the existing
pg_get_multixact_members() inside the new file, and applied the
result.

>> ReadMultiXactCounts() is also incorrectly named with your proposal to
>> expose oldestMultiXactId in the information returned to the caller...
>> So perhaps this should be named GetMultiXactInformation() or something
>> similar?
>
> Renamed to GetMultiXactInfo().

+ * Returns information about current MultiXact state in a single atomic read:

This comment is incorrect. This is not an atomic read, grabbing a
consistent state of the data across one single lock acquisition.

Except for this comment, this looks pretty much OK. Ashutosh, any
comments?

I have not looked at the rest.
--
Michael

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message zengman 2025-08-18 06:50:35 When deleting the plpgsql function, release the CachedPlan of the function
Previous Message Andrey Borodin 2025-08-18 06:43:05 Re: VM corruption on standby