summaryrefslogtreecommitdiff
path: root/src/include/pgstat.h
diff options
context:
space:
mode:
authorMichael Paquier2025-01-10 00:00:48 +0000
committerMichael Paquier2025-01-10 00:00:48 +0000
commit2c14037bb57c091b9f0bcbd36fa62138601beb55 (patch)
tree78d8895f3bb93a7e5466d83ade223e8798bca791 /src/include/pgstat.h
parent39e3bcae44868734504c3decbb6708c36a5a84b2 (diff)
Refactor some code related to backend statistics
This commit changes the way pending backend statistics are tracked by moving them into a new structure called PgStat_BackendPending, removing PgStat_BackendPendingIO. PgStat_BackendPending currently only includes PgStat_PendingIO for the pending I/O stats. pgstat_flush_backend() is extended with a "flags" argument to control which parts of the stats of a backend should be flushed. With this refactoring, it becomes easier to plug into backend statistics more data. A patch to add information related to WAL in this stats kind is under discussion. Author: Bertrand Drouvot Discussion: https://postgr.es/m/Z3zqc4o09dM/Ezyz@ip-10-97-1-34.eu-west-3.compute.internal
Diffstat (limited to 'src/include/pgstat.h')
-rw-r--r--src/include/pgstat.h17
1 files changed, 13 insertions, 4 deletions
diff --git a/src/include/pgstat.h b/src/include/pgstat.h
index 0d8427f27d1..f1dfe2b5e91 100644
--- a/src/include/pgstat.h
+++ b/src/include/pgstat.h
@@ -375,15 +375,24 @@ typedef struct PgStat_IO
PgStat_BktypeIO stats[BACKEND_NUM_TYPES];
} PgStat_IO;
-/* Backend statistics store the same amount of IO data as PGSTAT_KIND_IO */
-typedef PgStat_PendingIO PgStat_BackendPendingIO;
-
typedef struct PgStat_Backend
{
TimestampTz stat_reset_timestamp;
- PgStat_BktypeIO stats;
+ PgStat_BktypeIO io_stats;
} PgStat_Backend;
+/* ---------
+ * PgStat_BackendPending Non-flushed backend stats.
+ * ---------
+ */
+typedef struct PgStat_BackendPending
+{
+ /*
+ * Backend statistics store the same amount of IO data as PGSTAT_KIND_IO.
+ */
+ PgStat_PendingIO pending_io;
+} PgStat_BackendPending;
+
typedef struct PgStat_StatDBEntry
{
PgStat_Counter xact_commit;