Re: per backend WAL statistics
Bertrand Drouvot <bertranddrouvot.pg@gmail.com>
Attachments
- v12-0001-per-backend-WAL-statistics.patch (text/x-diff)
Hi, On Fri, Feb 28, 2025 at 11:34:14AM +0900, Michael Paquier wrote: > On Thu, Feb 27, 2025 at 07:47:09AM +0000, Bertrand Drouvot wrote: > > That's how I did it initially but decided to move it to pgstat_backend.c. The > > reason was that it's fully linked to "per backend" stats and that there is > > no SQL api on top of it (while I think that's the case for almost all the ones > > in pgstatfuncs.c). Thoughts? > > Okay by me with pgstat_fetch_stat_backend in parallel, why not > exposing this part as well.. Perhaps that could be useful for some > extension? I'd rather have out-of-core code do these lookups with the > same sanity checks in place for the procnumber and slot lookups. Yeah that's also a pros for it. > The name was inconsistent with the rest of the file, so I have settled > to a pgstat_fetch_stat_backend_by_pid() to be more consistent. Sounds good, thanks! > A > second thing is to properly initialize bktype if defined by the > caller. Saw that in c2a50ac678e, makes sense. > Attached is a rebased version of the rest. The rebased version looks ok. Also attaching the patch I mentioned up-thread to address some of Rahila's comments ([1]): It adds a AuxiliaryPidGetProc() call in pgstat_fetch_stat_backend_by_pid() and pg_stat_reset_backend_stats(). I think that fully makes sense since a051e71e28a modified pgstat_tracks_backend_bktype() for B_WAL_RECEIVER, B_WAL_SUMMARIZER and B_WAL_WRITER. It looks like it does not need doc updates. Attached as 0002 as it's somehow un-related to this thread (but not sure it deserves it's dedicated thread though). [1]: https://www.postgresql.org/message-id/CAH2L28v9BwN8_y0k6FQ591=0g2Hj_esHLGj3bP38c9nmVykoiA@mail.gmail.com [2]: https://www.postgresql.org/message-id/flat/Z8FMjlyNpNicucGa%40paquier.xyz#92d3e2b9ad860708f76b8f9c6f49f32d Regards, -- Bertrand Drouvot PostgreSQL Contributors Team RDS Open Source Databases Amazon Web Services: https://aws.amazon.com
Commits
-
Fix use-after-free in pgstat_fetch_stat_backend_by_pid()
- 3191a593d6de 18.0 landed
-
Remove initialization from PendingBackendStats
- f554a95379a9 18.0 landed
-
Add WAL data to backend statistics
- 76def4cdd7c2 18.0 landed
-
Improve check for detection of pending data in backend statistics
- 9a8dd2c5a6d9 18.0 landed
-
Fix some gaps in pg_stat_io with WAL receiver and WAL summarizer
- f4694e0f35b2 18.0 landed
-
Handle auxiliary processes in SQL functions of backend statistics
- 3f1db99bfabb 18.0 landed
-
Invent pgstat_fetch_stat_backend_by_pid()
- c2a50ac678eb 18.0 landed
-
Refactor code of pg_stat_get_wal() building result tuple
- 495864a4cf16 18.0 landed
-
Adding new PgStat_WalCounters structure in pgstat.h
- 0e42d31b0b22 18.0 landed
-
Remove pgstat_flush_wal()
- d7cbeaf261da 18.0 landed
-
Refactor some code related to backend statistics
- 2c14037bb57c 18.0 landed
-
Add backend-level statistics to pgstats
- 9aea73fc61d4 18.0 cited