1
0
mirror of https://github.com/postgres/postgres.git synced 2025-10-21 02:52:47 +03:00

pg_upgrade: Fix problems caused by renaming pg_resetxlog.

Commit 85c11324ca renamed pg_resetxlog
to pg_resetwal, but didn't make pg_upgrade smart enough to cope with
the situation.

Michael Paquier, per a complaint from Jeff Janes
This commit is contained in:
Robert Haas
2017-02-15 10:14:16 -05:00
parent 6d16ecc646
commit b877761123
3 changed files with 56 additions and 35 deletions

View File

@@ -70,6 +70,7 @@ get_control_data(ClusterInfo *cluster, bool live_check)
uint32 tli = 0;
uint32 logid = 0;
uint32 segno = 0;
char *resetwal_bin;
/*
@@ -111,9 +112,14 @@ get_control_data(ClusterInfo *cluster, bool live_check)
pg_putenv("LC_ALL", NULL);
pg_putenv("LC_MESSAGES", "C");
/* pg_resetxlog has been renamed to pg_resetwal in version 10 */
if (GET_MAJOR_VERSION(cluster->bin_version) < 1000)
resetwal_bin = "pg_resetxlog\" -n";
else
resetwal_bin = "pg_resetwal\" -n";
snprintf(cmd, sizeof(cmd), "\"%s/%s \"%s\"",
cluster->bindir,
live_check ? "pg_controldata\"" : "pg_resetwal\" -n",
live_check ? "pg_controldata\"" : resetwal_bin,
cluster->pgdata);
fflush(stdout);
fflush(stderr);