Skip to content

Commit d8d3b34

Browse files
authored
Fix check for database version inside pg_upgrade.
Due to recent project renaming, gpupgrade now failing to upgarde greenplum 6 to cloudberry. The issue is with check-database-version logic. Fix is kinda straightforward, the only issue is with dbstring2 variable name, as i cannot came up with anything better.
1 parent 1cc7649 commit d8d3b34

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

src/bin/pg_upgrade/exec.c

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,8 @@ get_bin_version(ClusterInfo *cluster)
3636
{
3737
char cmd[MAXPGPATH],
3838
cmd_output[MAX_STRING],
39-
dbstring[MAX_STRING];
39+
dbstring[MAX_STRING],
40+
dbstring2[MAX_STRING];
4041

4142
FILE *output;
4243
int v1 = 0,
@@ -51,11 +52,12 @@ get_bin_version(ClusterInfo *cluster)
5152

5253
pclose(output);
5354

54-
if (sscanf(cmd_output, "%*s (%s Database) %d.%d", dbstring, &v1, &v2) < 1)
55+
if (sscanf(cmd_output, "%*s (%s %s) %d.%d", dbstring, dbstring2, &v1, &v2) < 1)
5556
pg_fatal("could not get pg_ctl version output from %s\n", cmd);
5657

57-
if (strcmp("Greenplum", dbstring) && strcmp("Cloudberry", dbstring))
58-
pg_fatal("could not upgrade from non Greenplum/Cloudberry version: %s\n", dbstring);
58+
if ((strcmp("Greenplum", dbstring) == 0 && strcmp("Database", dbstring2) == 0) \
59+
|| (strcmp("Apache", dbstring2) == 0 && strcmp("Cloudberry", dbstring2) == 0))
60+
pg_fatal("could not upgrade from non Greenplum/Cloudberry version: %s %s\n", dbstring, dbstring2);
5961

6062
if (v1 < 10)
6163
{

0 commit comments

Comments
 (0)