Skip to content

Commit

Permalink
[#25336] YSQL: Disable check_is_install_user
Browse files Browse the repository at this point in the history
Summary:
Vanilla PG expects one user during the upgrade, the bootstrap super user. This defaults to
`postgres`, but can be set with the `-U` argument to `initdb`.

In Yugabyte, the upgrade might be run by different Yugabyte users. Rather than try to capture every possible yugabyte user and rewriting the check to that, we can just ignore the user check. Since we control the creation of the new cluster, we don't have to be as vigilant against weird cases as Postgres does.

Fixes #25336
Jira: DB-14549

Test Plan:
```
./yb_build.sh release --cxx-test pg15_upgrade-test
```

Reviewers: hsunder

Reviewed By: hsunder

Subscribers: yql

Differential Revision: https://phorge.dev.yugabyte.com/D40726
  • Loading branch information
timothy-e committed Dec 24, 2024
1 parent 2d315d8 commit 5c5f1cf
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 14 deletions.
23 changes: 12 additions & 11 deletions src/postgres/src/bin/pg_upgrade/check.c
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,6 @@ check_and_dump_old_cluster(bool live_check)
/* Extract a list of databases and tables from the old cluster */
get_db_and_rel_infos(&old_cluster);

#ifdef YB_TODO
/* Enable these checks and other functions to initialize new node */
init_tablespaces();

Expand All @@ -101,13 +100,7 @@ check_and_dump_old_cluster(bool live_check)
/*
* Check for various failure cases
*/
/*
* YB: this check requires the following conditions:
* 1. The logged in user is 'postgres' (oid = 10)
* 2. New cluster does not have any users
*/
check_is_install_user(&old_cluster);
#endif
check_proper_datallowconn(&old_cluster);
if (!is_yugabyte_enabled())
/* Yugabyte does not support prepared transactions, see #1125 */
Expand Down Expand Up @@ -208,7 +201,9 @@ check_new_cluster(void)
check_new_cluster_is_empty();
check_databases_are_compatible();

check_loadable_libraries();
if (!is_yugabyte_enabled())
/* YB: would fail with ERROR: LOAD not supported yet. */
check_loadable_libraries();

switch (user_opts.transfer_mode)
{
Expand All @@ -222,10 +217,8 @@ check_new_cluster(void)
break;
}

#ifdef YB_TODO
/* Investigate/implement this check */
check_is_install_user(&new_cluster);
#endif

check_for_prepared_transactions(&new_cluster);

check_for_new_tablespace_dir(&new_cluster);
Expand Down Expand Up @@ -667,6 +660,14 @@ create_script_for_old_cluster_deletion(char **deletion_script_file_name)
static void
check_is_install_user(ClusterInfo *cluster)
{
if (is_yugabyte_enabled())
/*
* YB: Since there are a few different yugabyte users that might run the
* upgrade, we disable this check rather than trying to modify it to
* work for every possible YB case.
*/
return;

PGresult *res;
PGconn *conn = connectToServer(cluster, "template1");

Expand Down
4 changes: 1 addition & 3 deletions src/postgres/src/bin/pg_upgrade/pg_upgrade.c
Original file line number Diff line number Diff line change
Expand Up @@ -159,10 +159,8 @@ main(int argc, char **argv)
if (!is_yugabyte_enabled())
start_postmaster(&new_cluster, true);

#ifdef YB_TODO
/* Investigate relevant checks within check_new_cluster */
check_new_cluster();
#endif

report_clusters_compatible();

pg_log(PG_REPORT,
Expand Down

0 comments on commit 5c5f1cf

Please sign in to comment.