mirror of
				https://github.com/postgres/postgres.git
				synced 2025-11-03 09:13:20 +03:00 
			
		
		
		
	Move SQL tests of pg_stat_io for WAL data to recovery test 029_stats_restart
Three tests in the main regression test suite are proving to not be portable across multiple runs on a deployed cluster as stats of pg_stat_io are reset. Problems happen for tests on: - Writes of WAL in the init context, when creating a WAL segment. - Syncs of WAL in the init context, when creating a WAL segment. - Reads of WAL in the normal context, requiring a WAL record to be read. For a `make check`, this could rely on the checkpoint record read by the startup process when starting the cluster, something that is not going to work for a deployed node. Two of the three tests are moved to the recovery TAP test 029_stats_restart, where we already check the consistency of stats data. The test for syncs is dropped as TAP can run with fsync=off. The other two are checked with some data from a freshly-initialized cluster. Per discussion with Tom Lane, Bertrand Drouvot and Nazir Bilal Yavuz. Discussion: https://postgr.es/m/915687.1738780322@sss.pgh.pa.us
This commit is contained in:
		@@ -442,20 +442,6 @@ SELECT (current_schemas(true))[1] = ('pg_temp_' || beid::text) AS match
 | 
			
		||||
FROM pg_stat_get_backend_idset() beid
 | 
			
		||||
WHERE pg_stat_get_backend_pid(beid) = pg_backend_pid();
 | 
			
		||||
 | 
			
		||||
-- Test pg_stat_io for WAL in an init context, that should do writes
 | 
			
		||||
-- and syncs.
 | 
			
		||||
SELECT sum(writes) AS writes, sum(fsyncs) AS fsyncs
 | 
			
		||||
  FROM pg_stat_io
 | 
			
		||||
  WHERE context = 'init' AND object = 'wal' \gset io_sum_wal_init_
 | 
			
		||||
SELECT :io_sum_wal_init_writes > 0;
 | 
			
		||||
SELECT current_setting('fsync') = 'off'
 | 
			
		||||
  OR :io_sum_wal_init_fsyncs > 0;
 | 
			
		||||
 | 
			
		||||
-- Test pg_stat_io for WAL in a normal context, that should do reads as well.
 | 
			
		||||
SELECT SUM(reads) > 0
 | 
			
		||||
  FROM pg_stat_io
 | 
			
		||||
  WHERE context = 'normal' AND object = 'wal';
 | 
			
		||||
 | 
			
		||||
-----
 | 
			
		||||
-- Test that resetting stats works for reset timestamp
 | 
			
		||||
-----
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user