Skip to content

Commit

Permalink
[#25429] YSQL: Address YB_TODO in exec.c
Browse files Browse the repository at this point in the history
Summary:
`ysqlsh -V` gives the following result:
```
psql (PostgreSQL) 15.2-YB-2.25.1.0-b0
```

The outputted command name is different than the actual command name.

There are three options to fix this check:
1. Update `ysqlsh -V` to print `ysqlsh (PostgreSQL) 15.2...`. This would have a pretty large impact.
2. Disable the check.
3. Modify the check to reflect the differences in Yugabyte.

Option 3 seems the best to preserve the safety of the check, without having a far-reaching impact, so this change uses that approach.
Jira: DB-14660

Test Plan: Jenkins

Reviewers: hsunder, fizaa

Reviewed By: hsunder

Subscribers: yql

Differential Revision: https://phorge.dev.yugabyte.com/D40888
  • Loading branch information
timothy-e committed Jan 14, 2025
1 parent a5efcb9 commit ded9b1c
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/postgres/src/bin/pg_upgrade/exec.c
Original file line number Diff line number Diff line change
Expand Up @@ -265,10 +265,12 @@ verify_directories(void)
if (!is_yugabyte_enabled() || user_opts.check)
/* YB: No "old cluster" data dir needed for actual upgrade. */
check_data_dir(&old_cluster);
check_bin_dir(&new_cluster, true);
if (!(is_yugabyte_enabled() && user_opts.check))
{
/* YB: No new cluster for preflight checks. */
check_bin_dir(&new_cluster, true);
check_data_dir(&new_cluster);
}
}


Expand Down Expand Up @@ -416,13 +418,10 @@ check_bin_dir(ClusterInfo *cluster, bool check_versions)
check_exec(cluster->bindir, "ysql_dump", check_versions);
check_exec(cluster->bindir, "ysql_dumpall", check_versions);
check_exec(cluster->bindir, "pg_restore", check_versions);
#ifdef YB_TODO
/* Make this version check work (ysqlsh -V returns psql, name mismatch) */
if (is_yugabyte_enabled())
check_exec(cluster->bindir, "ysqlsh", check_versions);
else
check_exec(cluster->bindir, "psql", check_versions);
#endif
check_exec(cluster->bindir, "vacuumdb", check_versions);
}
}
Expand Down Expand Up @@ -458,6 +457,8 @@ check_exec(const char *dir, const char *program, bool check_version)
pg_strip_crlf(line);
if (strstr(cmd, "ysql_dump") != NULL)
snprintf(versionstr, sizeof(versionstr), "%s (YSQL) " PG_VERSION, program);
else if (strstr(cmd, "ysqlsh") != NULL)
snprintf(versionstr, sizeof(versionstr), "%s (PostgreSQL) " PG_VERSION, "psql");
else
snprintf(versionstr, sizeof(versionstr), "%s (PostgreSQL) " PG_VERSION, program);

Expand Down

0 comments on commit ded9b1c

Please sign in to comment.