mirror of
				https://github.com/postgres/postgres.git
				synced 2025-11-03 09:13:20 +03:00 
			
		
		
		
	Add regression test listing all the possible tuples in pg_stat_io
pg_stat_io returns a set of tuples based on a combination of three properties (BackendType, IOObject and IOContext) and pgstat_tracks_io_object() to decide if a BackendType should return a tuple based on a pair made of an IOObject and an IOContext. This commit adds a regression test to track all the combinations supported. This is useful to know which tuples are relevant when adding a new BackendType to the set or when touching pgstat_tracks_io_object(), and I have noticed while playing with this area that it is not complicated to break it without the regression tests noticing a difference in some cases. Reviewed-by: Bertrand Drouvot <bertranddrouvot.pg@gmail.com> Discussion: https://postgr.es/m/Z8exfAehbVbEKXW5@paquier.xyz
This commit is contained in:
		@@ -11,6 +11,84 @@ SHOW track_counts;  -- must be on
 | 
				
			|||||||
 on
 | 
					 on
 | 
				
			||||||
(1 row)
 | 
					(1 row)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					-- List of backend types, contexts and objects tracked in pg_stat_io.
 | 
				
			||||||
 | 
					\a
 | 
				
			||||||
 | 
					SELECT backend_type, object, context FROM pg_stat_io
 | 
				
			||||||
 | 
					  ORDER BY backend_type, object, context COLLATE "C";
 | 
				
			||||||
 | 
					backend_type|object|context
 | 
				
			||||||
 | 
					autovacuum launcher|relation|bulkread
 | 
				
			||||||
 | 
					autovacuum launcher|relation|init
 | 
				
			||||||
 | 
					autovacuum launcher|relation|normal
 | 
				
			||||||
 | 
					autovacuum launcher|wal|init
 | 
				
			||||||
 | 
					autovacuum launcher|wal|normal
 | 
				
			||||||
 | 
					autovacuum worker|relation|bulkread
 | 
				
			||||||
 | 
					autovacuum worker|relation|init
 | 
				
			||||||
 | 
					autovacuum worker|relation|normal
 | 
				
			||||||
 | 
					autovacuum worker|relation|vacuum
 | 
				
			||||||
 | 
					autovacuum worker|wal|init
 | 
				
			||||||
 | 
					autovacuum worker|wal|normal
 | 
				
			||||||
 | 
					background worker|relation|bulkread
 | 
				
			||||||
 | 
					background worker|relation|bulkwrite
 | 
				
			||||||
 | 
					background worker|relation|init
 | 
				
			||||||
 | 
					background worker|relation|normal
 | 
				
			||||||
 | 
					background worker|relation|vacuum
 | 
				
			||||||
 | 
					background worker|temp relation|normal
 | 
				
			||||||
 | 
					background worker|wal|init
 | 
				
			||||||
 | 
					background worker|wal|normal
 | 
				
			||||||
 | 
					background writer|relation|init
 | 
				
			||||||
 | 
					background writer|relation|normal
 | 
				
			||||||
 | 
					background writer|wal|init
 | 
				
			||||||
 | 
					background writer|wal|normal
 | 
				
			||||||
 | 
					checkpointer|relation|init
 | 
				
			||||||
 | 
					checkpointer|relation|normal
 | 
				
			||||||
 | 
					checkpointer|wal|init
 | 
				
			||||||
 | 
					checkpointer|wal|normal
 | 
				
			||||||
 | 
					client backend|relation|bulkread
 | 
				
			||||||
 | 
					client backend|relation|bulkwrite
 | 
				
			||||||
 | 
					client backend|relation|init
 | 
				
			||||||
 | 
					client backend|relation|normal
 | 
				
			||||||
 | 
					client backend|relation|vacuum
 | 
				
			||||||
 | 
					client backend|temp relation|normal
 | 
				
			||||||
 | 
					client backend|wal|init
 | 
				
			||||||
 | 
					client backend|wal|normal
 | 
				
			||||||
 | 
					slotsync worker|relation|bulkread
 | 
				
			||||||
 | 
					slotsync worker|relation|bulkwrite
 | 
				
			||||||
 | 
					slotsync worker|relation|init
 | 
				
			||||||
 | 
					slotsync worker|relation|normal
 | 
				
			||||||
 | 
					slotsync worker|relation|vacuum
 | 
				
			||||||
 | 
					slotsync worker|temp relation|normal
 | 
				
			||||||
 | 
					slotsync worker|wal|init
 | 
				
			||||||
 | 
					slotsync worker|wal|normal
 | 
				
			||||||
 | 
					standalone backend|relation|bulkread
 | 
				
			||||||
 | 
					standalone backend|relation|bulkwrite
 | 
				
			||||||
 | 
					standalone backend|relation|init
 | 
				
			||||||
 | 
					standalone backend|relation|normal
 | 
				
			||||||
 | 
					standalone backend|relation|vacuum
 | 
				
			||||||
 | 
					standalone backend|wal|init
 | 
				
			||||||
 | 
					standalone backend|wal|normal
 | 
				
			||||||
 | 
					startup|relation|bulkread
 | 
				
			||||||
 | 
					startup|relation|bulkwrite
 | 
				
			||||||
 | 
					startup|relation|init
 | 
				
			||||||
 | 
					startup|relation|normal
 | 
				
			||||||
 | 
					startup|relation|vacuum
 | 
				
			||||||
 | 
					startup|wal|init
 | 
				
			||||||
 | 
					startup|wal|normal
 | 
				
			||||||
 | 
					walreceiver|wal|init
 | 
				
			||||||
 | 
					walreceiver|wal|normal
 | 
				
			||||||
 | 
					walsender|relation|bulkread
 | 
				
			||||||
 | 
					walsender|relation|bulkwrite
 | 
				
			||||||
 | 
					walsender|relation|init
 | 
				
			||||||
 | 
					walsender|relation|normal
 | 
				
			||||||
 | 
					walsender|relation|vacuum
 | 
				
			||||||
 | 
					walsender|temp relation|normal
 | 
				
			||||||
 | 
					walsender|wal|init
 | 
				
			||||||
 | 
					walsender|wal|normal
 | 
				
			||||||
 | 
					walsummarizer|wal|init
 | 
				
			||||||
 | 
					walsummarizer|wal|normal
 | 
				
			||||||
 | 
					walwriter|wal|init
 | 
				
			||||||
 | 
					walwriter|wal|normal
 | 
				
			||||||
 | 
					(71 rows)
 | 
				
			||||||
 | 
					\a
 | 
				
			||||||
-- ensure that both seqscan and indexscan plans are allowed
 | 
					-- ensure that both seqscan and indexscan plans are allowed
 | 
				
			||||||
SET enable_seqscan TO on;
 | 
					SET enable_seqscan TO on;
 | 
				
			||||||
SET enable_indexscan TO on;
 | 
					SET enable_indexscan TO on;
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -8,6 +8,12 @@
 | 
				
			|||||||
-- conditio sine qua non
 | 
					-- conditio sine qua non
 | 
				
			||||||
SHOW track_counts;  -- must be on
 | 
					SHOW track_counts;  -- must be on
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					-- List of backend types, contexts and objects tracked in pg_stat_io.
 | 
				
			||||||
 | 
					\a
 | 
				
			||||||
 | 
					SELECT backend_type, object, context FROM pg_stat_io
 | 
				
			||||||
 | 
					  ORDER BY backend_type, object, context COLLATE "C";
 | 
				
			||||||
 | 
					\a
 | 
				
			||||||
 | 
					
 | 
				
			||||||
-- ensure that both seqscan and indexscan plans are allowed
 | 
					-- ensure that both seqscan and indexscan plans are allowed
 | 
				
			||||||
SET enable_seqscan TO on;
 | 
					SET enable_seqscan TO on;
 | 
				
			||||||
SET enable_indexscan TO on;
 | 
					SET enable_indexscan TO on;
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user