public inbox for [email protected]  
help / color / mirror / Atom feed
From: Ian Lawrence Barwick <[email protected]>
To: Nathan Bossart <[email protected]>
Cc: pgsql-hackers <[email protected]>
Cc: [email protected]
Subject: Re: pg_stat_get_backend_subxact() and backend IDs?
Date: Fri, 25 Aug 2023 09:36:18 +0900
Message-ID: <CAB8KJ=iWYvB1odjFRZybsPeUV8HUAiVVjY9RMHSdvWy1t77cLg@mail.gmail.com> (raw)
In-Reply-To: <[email protected]>
References: <CAB8KJ=j-ACb3H4L9a_b3ZG3iCYDW5aEu3WsPAzkm2S7JzS1Few@mail.gmail.com>
	<[email protected]>
	<[email protected]>
	<[email protected]>

2023年8月25日(金) 1:19 Nathan Bossart <[email protected]>:
>
> 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?

Thanks for looking at this. In summary we now have these functions:

 extern PgBackendStatus      *pgstat_get_beentry_by_backend_id(BackendId beid);
 extern LocalPgBackendStatus
*pgstat_get_local_beentry_by_backend_id(BackendId beid);
 extern LocalPgBackendStatus *pgstat_get_local_beentry_by_index(int beid);

which LGTM; patches work as expected and resolve the reported issue.

Regards

Ian Barwick






view thread (10+ messages)  latest in thread

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 using the --to and --cc options:
  reply via email

  To: [email protected]
  Cc: [email protected], [email protected], [email protected]
  Subject: Re: pg_stat_get_backend_subxact() and backend IDs?
  In-Reply-To: <CAB8KJ=iWYvB1odjFRZybsPeUV8HUAiVVjY9RMHSdvWy1t77cLg@mail.gmail.com>

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

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