Re: pg_stat_get_backend_subxact() and backend IDs?

2023-09-18 Thread Ian Lawrence Barwick
2023年8月31日(木) 6:56 Nathan Bossart : > > On Wed, Aug 30, 2023 at 10:56:22AM -0400, Robert Haas wrote: > > On Wed, Aug 30, 2023 at 10:27 AM Nathan Bossart > > wrote: > >> I'm about to spend way too much time writing the commit message for 0002, > >> but I plan to commit both patches sometime today.

Re: pg_stat_get_backend_subxact() and backend IDs?

2023-08-31 Thread Dilip Kumar
On Thu, Aug 31, 2023 at 4:38 AM Nathan Bossart wrote: > > On Wed, Aug 30, 2023 at 10:56:22AM -0400, Robert Haas wrote: > > On Wed, Aug 30, 2023 at 10:27 AM Nathan Bossart > > wrote: > >> I'm about to spend way too much time writing the commit message for 0002, > >> but I plan to commit both

Re: pg_stat_get_backend_subxact() and backend IDs?

2023-08-30 Thread Michael Paquier
On Wed, Aug 30, 2023 at 02:56:48PM -0700, Nathan Bossart wrote: > Committed. Cool, thanks! -- Michael signature.asc Description: PGP signature

Re: pg_stat_get_backend_subxact() and backend IDs?

2023-08-30 Thread Nathan Bossart
On Wed, Aug 30, 2023 at 10:56:22AM -0400, Robert Haas wrote: > On Wed, Aug 30, 2023 at 10:27 AM Nathan Bossart > wrote: >> I'm about to spend way too much time writing the commit message for 0002, >> but I plan to commit both patches sometime today. > > Thanks! I'm glad your committing the

Re: pg_stat_get_backend_subxact() and backend IDs?

2023-08-30 Thread Robert Haas
On Wed, Aug 30, 2023 at 10:27 AM Nathan Bossart wrote: > On Wed, Aug 30, 2023 at 09:50:41AM -0400, Robert Haas wrote: > > Sorry, I'm only just noticing this thread. Thanks, Nathan, Ian, and > > others, for your work on this. Apart from hoping that the 0002 patch > > will get a more detailed

Re: pg_stat_get_backend_subxact() and backend IDs?

2023-08-30 Thread Nathan Bossart
On Wed, Aug 30, 2023 at 09:50:41AM -0400, Robert Haas wrote: > Sorry, I'm only just noticing this thread. Thanks, Nathan, Ian, and > others, for your work on this. Apart from hoping that the 0002 patch > will get a more detailed commit message spelling out the problem very > explicitly, I don't

Re: pg_stat_get_backend_subxact() and backend IDs?

2023-08-30 Thread Robert Haas
On Wed, Aug 30, 2023 at 12:13 AM Michael Paquier wrote: > Yep, that looks more consistent, at quick glance. Sorry, I'm only just noticing this thread. Thanks, Nathan, Ian, and others, for your work on this. Apart from hoping that the 0002 patch will get a more detailed commit message spelling

Re: pg_stat_get_backend_subxact() and backend IDs?

2023-08-29 Thread Michael Paquier
On Tue, Aug 29, 2023 at 07:01:51PM -0700, Nathan Bossart wrote: > On Wed, Aug 30, 2023 at 08:22:27AM +0900, Michael Paquier wrote: >> +extern LocalPgBackendStatus *pgstat_get_local_beentry_by_index(int beid); >> >> Still I would to a bit more of s/beid/id/ for cases where the code >> refers to

Re: pg_stat_get_backend_subxact() and backend IDs?

2023-08-29 Thread Nathan Bossart
On Wed, Aug 30, 2023 at 08:22:27AM +0900, Michael Paquier wrote: > On Tue, Aug 29, 2023 at 09:46:55AM -0700, Nathan Bossart wrote: >> This was my first reaction [0]. I was concerned about renaming the >> exported functions so close to release, so I was suggesting that we hold >> off on that part

Re: pg_stat_get_backend_subxact() and backend IDs?

2023-08-29 Thread Michael Paquier
On Tue, Aug 29, 2023 at 09:46:55AM -0700, Nathan Bossart wrote: > This was my first reaction [0]. I was concerned about renaming the > exported functions so close to release, so I was suggesting that we hold > off on that part until v17. If there isn't a concern with renaming these > functions

Re: pg_stat_get_backend_subxact() and backend IDs?

2023-08-29 Thread Nathan Bossart
On Mon, Aug 28, 2023 at 10:53:52AM +0900, Michael Paquier wrote: > I understand that this is not a fantastic naming, but renaming > pgstat_fetch_stat_local_beentry() to something like > pgstat_fetch_stat_local_beentry_by_{index|position}_id() would make > the difference much easier to grasp, and

Re: pg_stat_get_backend_subxact() and backend IDs?

2023-08-27 Thread Michael Paquier
On Fri, Aug 25, 2023 at 10:56:14PM +, Imseih (AWS), Sami wrote: > > Here is a new version of the patch that avoids changing the names of the > > existing functions. I'm not thrilled about the name > > (pgstat_fetch_stat_local_beentry_by_backend_id), so I am open to > > suggestions. In any

Re: pg_stat_get_backend_subxact() and backend IDs?

2023-08-25 Thread Imseih (AWS), Sami
> Here is a new version of the patch that avoids changing the names of the > existing functions. I'm not thrilled about the name > (pgstat_fetch_stat_local_beentry_by_backend_id), so I am open to > suggestions. In any case, I'd like to rename all three of the> > pgstat_fetch_stat_* functions in

Re: pg_stat_get_backend_subxact() and backend IDs?

2023-08-25 Thread Nathan Bossart
On Fri, Aug 25, 2023 at 08:32:51AM -0700, Nathan Bossart wrote: > On second thought, renaming these exported functions so close to release is > probably not a great idea. I should probably skip back-patching that one. > Or I could have the existing functions call the new ones in v16 for >

Re: pg_stat_get_backend_subxact() and backend IDs?

2023-08-25 Thread Nathan Bossart
On Fri, Aug 25, 2023 at 03:01:40PM +, Imseih (AWS), Sami wrote: > 1/ cast the return of bsearch. This was done previously and is the common > convention in the code. Will do. > 2/ This will probably be a good time to update the docs for > pg_stat_get_backend_subxact [1] > to call out that

Re: pg_stat_get_backend_subxact() and backend IDs?

2023-08-25 Thread Nathan Bossart
On Fri, Aug 25, 2023 at 09:36:18AM +0900, Ian Lawrence Barwick wrote: > Thanks for looking at this. In summary we now have these functions: > > extern PgBackendStatus *pgstat_get_beentry_by_backend_id(BackendId > beid); > extern LocalPgBackendStatus >

Re: pg_stat_get_backend_subxact() and backend IDs?

2023-08-25 Thread Imseih (AWS), Sami
I tested the patch and it does the correct thing. I have a few comments: 1/ cast the return of bsearch. This was done previously and is the common convention in the code. So + return bsearch(, localBackendStatusTable, localNumBackends, +

Re: pg_stat_get_backend_subxact() and backend IDs?

2023-08-24 Thread Ian Lawrence Barwick
2023年8月25日(金) 1:19 Nathan Bossart : > > 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

Re: pg_stat_get_backend_subxact() and backend IDs?

2023-08-24 Thread Nathan Bossart
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()" >>>

Re: pg_stat_get_backend_subxact() and backend IDs?

2023-08-23 Thread Nathan Bossart
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

Re: pg_stat_get_backend_subxact() and backend IDs?

2023-08-23 Thread Nathan Bossart
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() and backend IDs?

2023-08-23 Thread Ian Lawrence Barwick
Hi I was playing around with "pg_stat_get_backend_subxact()" (commit 10ea0f924) and see it emits NULL values for some backends, e.g.: postgres=# \pset null NULL Null display is "NULL". postgres=# SELECT id, pg_stat_get_backend_pid(id), s.*,