mirror of
				https://github.com/postgres/postgres.git
				synced 2025-11-03 09:13:20 +03:00 
			
		
		
		
	Fix bogus logic for checking data dirs' versions within pg_upgrade.
Commit 9be95ef15 failed to cure all of the redundancy here: we were
actually calling get_major_server_version() three times for each
of the old and new data directories.  While that's not enormously
expensive, it's still sloppy.
A. Akenteva
Discussion: https://postgr.es/m/f9266a85d918a3cf3a386b5148aee666@postgrespro.ru
			
			
This commit is contained in:
		@@ -234,9 +234,9 @@ check_cluster_versions(void)
 | 
				
			|||||||
{
 | 
					{
 | 
				
			||||||
	prep_status("Checking cluster versions");
 | 
						prep_status("Checking cluster versions");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	/* get old and new cluster versions */
 | 
						/* cluster versions should already have been obtained */
 | 
				
			||||||
	old_cluster.major_version = get_major_server_version(&old_cluster);
 | 
						Assert(old_cluster.major_version != 0);
 | 
				
			||||||
	new_cluster.major_version = get_major_server_version(&new_cluster);
 | 
						Assert(new_cluster.major_version != 0);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	/*
 | 
						/*
 | 
				
			||||||
	 * We allow upgrades from/to the same major version for alpha/beta
 | 
						 * We allow upgrades from/to the same major version for alpha/beta
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -331,9 +331,8 @@ check_data_dir(ClusterInfo *cluster)
 | 
				
			|||||||
{
 | 
					{
 | 
				
			||||||
	const char *pg_data = cluster->pgdata;
 | 
						const char *pg_data = cluster->pgdata;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	/* get old and new cluster versions */
 | 
						/* get the cluster version */
 | 
				
			||||||
	old_cluster.major_version = get_major_server_version(&old_cluster);
 | 
						cluster->major_version = get_major_server_version(cluster);
 | 
				
			||||||
	new_cluster.major_version = get_major_server_version(&new_cluster);
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
	check_single_dir(pg_data, "");
 | 
						check_single_dir(pg_data, "");
 | 
				
			||||||
	check_single_dir(pg_data, "base");
 | 
						check_single_dir(pg_data, "base");
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user