diff options
author | Andres Freund <andres@anarazel.de> | 2023-05-17 11:18:35 -0700 |
---|---|---|
committer | Andres Freund <andres@anarazel.de> | 2023-05-17 11:18:35 -0700 |
commit | 093e5c57d506783a95dd8feddd9a3f2651e1aeba (patch) | |
tree | 95de46d45e866ed9a059a18f546690e675370cb8 /src/include | |
parent | 52676dc2e016df5cd842a4f6073b25ee8e681b9f (diff) | |
download | postgresql-093e5c57d506783a95dd8feddd9a3f2651e1aeba.tar.gz |
Add writeback to pg_stat_io
28e626bde00 added the concept of IOOps but neglected to include writeback
operations. ac8d53dae5 added time spent doing these I/O operations. Without
counting writeback, checkpointer write time in the log often differed
substantially from that in pg_stat_io. To fix this, add IOOp IOOP_WRITEBACK
and track writeback in pg_stat_io.
Bumps catversion.
Author: Melanie Plageman <melanieplageman@gmail.com>
Reviewed-by: Kyotaro Horiguchi <horikyota.ntt@gmail.com>
Reported-by: Andres Freund <andres@anarazel.de>
Discussion: https://postgr.es/m/20230419172326.dhgyo4wrrhulovt6%40awork3.anarazel.de
Diffstat (limited to 'src/include')
-rw-r--r-- | src/include/catalog/catversion.h | 2 | ||||
-rw-r--r-- | src/include/catalog/pg_proc.dat | 6 | ||||
-rw-r--r-- | src/include/pgstat.h | 3 | ||||
-rw-r--r-- | src/include/storage/buf_internals.h | 5 |
4 files changed, 9 insertions, 7 deletions
diff --git a/src/include/catalog/catversion.h b/src/include/catalog/catversion.h index 1afcfaf5ac..65e2e7e99c 100644 --- a/src/include/catalog/catversion.h +++ b/src/include/catalog/catversion.h @@ -57,6 +57,6 @@ */ /* yyyymmddN */ -#define CATALOG_VERSION_NO 202305172 +#define CATALOG_VERSION_NO 202305173 #endif diff --git a/src/include/catalog/pg_proc.dat b/src/include/catalog/pg_proc.dat index d7a60b39b5..e39d3b2b71 100644 --- a/src/include/catalog/pg_proc.dat +++ b/src/include/catalog/pg_proc.dat @@ -5734,9 +5734,9 @@ proname => 'pg_stat_get_io', provolatile => 'v', prorows => '30', proretset => 't', proparallel => 'r', prorettype => 'record', proargtypes => '', - proallargtypes => '{text,text,text,int8,float8,int8,float8,int8,float8,int8,int8,int8,int8,int8,float8,timestamptz}', - proargmodes => '{o,o,o,o,o,o,o,o,o,o,o,o,o,o,o,o}', - proargnames => '{backend_type,object,context,reads,read_time,writes,write_time,extends,extend_time,op_bytes,hits,evictions,reuses,fsyncs,fsync_time,stats_reset}', + proallargtypes => '{text,text,text,int8,float8,int8,float8,int8,float8,int8,float8,int8,int8,int8,int8,int8,float8,timestamptz}', + proargmodes => '{o,o,o,o,o,o,o,o,o,o,o,o,o,o,o,o,o,o}', + proargnames => '{backend_type,object,context,reads,read_time,writes,write_time,writebacks,writeback_time,extends,extend_time,op_bytes,hits,evictions,reuses,fsyncs,fsync_time,stats_reset}', prosrc => 'pg_stat_get_io' }, { oid => '1136', descr => 'statistics: information about WAL activity', diff --git a/src/include/pgstat.h b/src/include/pgstat.h index fff4ad5b6d..57a2c0866a 100644 --- a/src/include/pgstat.h +++ b/src/include/pgstat.h @@ -300,9 +300,10 @@ typedef enum IOOp IOOP_READ, IOOP_REUSE, IOOP_WRITE, + IOOP_WRITEBACK, } IOOp; -#define IOOP_NUM_TYPES (IOOP_WRITE + 1) +#define IOOP_NUM_TYPES (IOOP_WRITEBACK + 1) typedef struct PgStat_BktypeIO { diff --git a/src/include/storage/buf_internals.h b/src/include/storage/buf_internals.h index f8ac811379..30807d5d97 100644 --- a/src/include/storage/buf_internals.h +++ b/src/include/storage/buf_internals.h @@ -388,8 +388,9 @@ extern PGDLLIMPORT CkptSortItem *CkptBufferIds; */ /* bufmgr.c */ extern void WritebackContextInit(WritebackContext *context, int *max_pending); -extern void IssuePendingWritebacks(WritebackContext *wb_context); -extern void ScheduleBufferTagForWriteback(WritebackContext *wb_context, BufferTag *tag); +extern void IssuePendingWritebacks(WritebackContext *wb_context, IOContext io_context); +extern void ScheduleBufferTagForWriteback(WritebackContext *wb_context, + IOContext io_context, BufferTag *tag); /* freelist.c */ extern IOContext IOContextForStrategy(BufferAccessStrategy strategy); |