Re: pg_stat_bgwriter.buffers_backend is pretty meaningless (and more?)
Melanie Plageman <melanieplageman@gmail.com>
Attachments
- v15-0007-small-comment-correction.patch (application/octet-stream) patch v15-0007
- v15-0004-Add-buffers-to-pgstat_reset_shared_counters.patch (application/octet-stream) patch v15-0004
- v15-0006-Remove-superfluous-bgwriter-stats.patch (application/octet-stream) patch v15-0006
- v15-0003-Send-IO-operations-to-stats-collector.patch (application/octet-stream) patch v15-0003
- v15-0005-Add-system-view-tracking-IO-ops-per-backend-type.patch (application/octet-stream) patch v15-0005
- v15-0002-Add-IO-operation-counters-to-PgBackendStatus.patch (application/octet-stream) patch v15-0002
- v15-0001-Read-only-atomic-backend-write-function.patch (application/octet-stream) patch v15-0001
On Fri, Nov 19, 2021 at 11:49 AM Andres Freund <andres@anarazel.de> wrote:
> > +/*
> > + * On modern systems this is really just *counter++. On some older systems
> > + * there might be more to it, due to inability to read and write 64 bit values
> > + * atomically.
> > + */
> > +static inline void inc_counter(pg_atomic_uint64 *counter)
> > +{
> > + pg_atomic_write_u64(counter, pg_atomic_read_u64(counter) + 1);
> > +}
> > +
> > #undef INSIDE_ATOMICS_H
>
> Why is this using a completely different naming scheme from the rest of the
> file?
It was what Thomas originally named it. Also, I noticed all the other
pg_atomic* in this file were wrappers around the same impl function, so
I thought maybe naming it this way would be confusing. I renamed it to
pg_atomic_inc_counter(), though maybe pg_atomic_readonly_write() would
be better?
>
> > doc/src/sgml/monitoring.sgml | 116 +++++++++++++-
> > src/backend/catalog/system_views.sql | 11 ++
> > src/backend/postmaster/checkpointer.c | 3 +-
> > src/backend/postmaster/pgstat.c | 161 +++++++++++++++++++-
> > src/backend/storage/buffer/bufmgr.c | 46 ++++--
> > src/backend/storage/buffer/freelist.c | 23 ++-
> > src/backend/storage/buffer/localbuf.c | 3 +
> > src/backend/storage/sync/sync.c | 1 +
> > src/backend/utils/activity/backend_status.c | 60 +++++++-
> > src/backend/utils/adt/pgstatfuncs.c | 152 ++++++++++++++++++
> > src/include/catalog/pg_proc.dat | 9 ++
> > src/include/miscadmin.h | 2 +
> > src/include/pgstat.h | 53 +++++++
> > src/include/storage/buf_internals.h | 4 +-
> > src/include/utils/backend_status.h | 80 ++++++++++
> > src/test/regress/expected/rules.out | 8 +
> > 16 files changed, 701 insertions(+), 31 deletions(-)
>
> This is a pretty large change, I wonder if there's a way to make it a bit more
> granular.
>
I have done this. See v15 patch set attached.
- Melanie
Commits
-
Stabilize pg_stat_io writes test
- ef719e7b32fc 16.0 landed
-
Fix flakey pg_stat_io test
- 1be0fdb9de55 16.0 landed
-
Suppress more compiler warnings in new pgstats code.
- b1b86820d84e 16.0 landed
-
Suppress compiler warnings in new pgstats code.
- 728560db7d86 16.0 landed
-
Add tests for pg_stat_io
- 10a082bf7215 16.0 landed
-
Create regress_tblspc in test_setup
- 9c83bbcf7ef6 16.0 landed
-
Add pg_stat_io view, providing more detailed IO statistics
- a9c70b46dbe1 16.0 landed
-
pgstat: Track more detailed relation IO statistics
- f30d62c2fc60 16.0 landed
-
pgstat: Infrastructure for more detailed IO statistics
- 28e626bde00e 16.0 landed
-
doc: Fix some issues in logical replication section
- 4f74f5641d53 16.0 cited
-
Manual cleanup and pgindent of pgstat and bufmgr related code
- 250c8ee07ede 16.0 landed
-
Have the planner consider Incremental Sort for DISTINCT
- 3c6fc58209f2 16.0 cited
-
Use actual backend IDs in pg_stat_get_backend_idset() and friends.
- d7e39d72ca1c 16.0 cited
-
Remove redundant call to pgstat_report_wal()
- 1bdd54e662d5 16.0 landed
-
Add BackendType for standalone backends
- 0c679464a837 16.0 landed
-
Initialize backend status reporting during bootstrap.
- 3b34645678d1 15.0 landed