Re: pg_stat_get_backend_subxact() and backend IDs?

From: Nathan Bossart <nathandbossart(at)gmail(dot)com>
To: Ian Lawrence Barwick <barwick(at)gmail(dot)com>
Cc: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>, robertmhaas(at)gmail(dot)com
Subject: Re: pg_stat_get_backend_subxact() and backend IDs?
Date: 2023-08-24 16:19:13
Message-ID: 20230824161913.GA1394441@nathanxps13.lan
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Wed, Aug 23, 2023 at 07:51:40PM -0700, Nathan Bossart wrote:
> On Wed, Aug 23, 2023 at 07:32:06PM -0700, Nathan Bossart wrote:
>> On Thu, Aug 24, 2023 at 10:22:49AM +0900, Ian Lawrence Barwick wrote:
>>> Looking at the code, this is happening because
>>> "pgstat_fetch_stat_local_beentry()"
>>> expects to be passed the backend ID as an integer representing a 1-based index
>>> referring to "localBackendStatusTable", but "pg_stat_get_backend_subxact()"
>>> is presumably intended to take the actual BackendId , as per other
>>> "pg_stat_get_XXX()"
>>> functions.
>>
>> Yes, this was changed in d7e39d7, but 10ea0f9 seems to have missed the
>> memo.
>
> BTW I'd argue that this is a bug in v16 that we should try to fix before
> GA, so I've added an open item [0]. I assigned it to Robert (CC'd) since
> he was the committer, but I'm happy to pick it up.

Since RC1 is fast approaching, I put together a revised patch set. 0001
renames the existing pgstat_fetch_stat* functions, and 0002 adds
pgstat_get_local_beentry_by_backend_id() and uses it for
pg_stat_get_backend_subxact(). Thoughts?

--
Nathan Bossart
Amazon Web Services: https://aws.amazon.com

Attachment Content-Type Size
v2-0001-rename-some-pgstat-functions.patch text/x-diff 9.7 KB
v2-0002-fix-pg_stat_get_backend_subxact-to-use-real-backe.patch text/x-diff 3.3 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Matthias van de Meent 2023-08-24 16:23:18 Re: Disabling Heap-Only Tuples
Previous Message Jerry Sievert 2023-08-24 15:42:57 Altering the SELECT portion of a CREATE TABLE AS plan