Skip to content

Commit 164d633

Browse files
committed
Fix bogus logic for checking data dirs' versions within pg_upgrade.
Commit 9be95ef 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
1 parent ed9b360 commit 164d633

File tree

2 files changed

+5
-6
lines changed

2 files changed

+5
-6
lines changed

src/bin/pg_upgrade/check.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -234,9 +234,9 @@ check_cluster_versions(void)
234234
{
235235
prep_status("Checking cluster versions");
236236

237-
/* get old and new cluster versions */
238-
old_cluster.major_version = get_major_server_version(&old_cluster);
239-
new_cluster.major_version = get_major_server_version(&new_cluster);
237+
/* cluster versions should already have been obtained */
238+
Assert(old_cluster.major_version != 0);
239+
Assert(new_cluster.major_version != 0);
240240

241241
/*
242242
* We allow upgrades from/to the same major version for alpha/beta

src/bin/pg_upgrade/exec.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -331,9 +331,8 @@ check_data_dir(ClusterInfo *cluster)
331331
{
332332
const char *pg_data = cluster->pgdata;
333333

334-
/* get old and new cluster versions */
335-
old_cluster.major_version = get_major_server_version(&old_cluster);
336-
new_cluster.major_version = get_major_server_version(&new_cluster);
334+
/* get the cluster version */
335+
cluster->major_version = get_major_server_version(cluster);
337336

338337
check_single_dir(pg_data, "");
339338
check_single_dir(pg_data, "base");

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy