mirror of
				https://github.com/postgres/postgres.git
				synced 2025-11-03 09:13:20 +03:00 
			
		
		
		
	Fix possible failure to send final transaction counts to stats collector.
Normally, we suppress sending a tabstats message to the collector unless
there were some actual table stats to send.  However, during backend exit
we should force out the message if there are any transaction commit/abort
counts to send, else the session's last few commit/abort counts will never
get reported at all.  We had logic for this, but the short-circuit test
at the top of pgstat_report_stat() ignored the "force" flag, with the
consequence that session-ending transactions that touched no database-local
tables would not get counted.  Seems to be an oversight in my commit
641912b4d1, which added the "force" flag.
That was back in 8.3, so back-patch to all supported versions.
			
			
This commit is contained in:
		@@ -682,8 +682,8 @@ pgstat_report_stat(bool force)
 | 
				
			|||||||
	int			i;
 | 
						int			i;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	/* Don't expend a clock check if nothing to do */
 | 
						/* Don't expend a clock check if nothing to do */
 | 
				
			||||||
	if ((pgStatTabList == NULL || pgStatTabList->tsa_used == 0)
 | 
						if ((pgStatTabList == NULL || pgStatTabList->tsa_used == 0) &&
 | 
				
			||||||
		&& !have_function_stats)
 | 
							!have_function_stats && !force)
 | 
				
			||||||
		return;
 | 
							return;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	/*
 | 
						/*
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user