This is an automated email from the ASF dual-hosted git repository.

reshke pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/cloudberry.git

commit 1f586b78f88c5d96dfe2d4fa3f176f0807228a6e
Author: Brent Doil <[email protected]>
AuthorDate: Tue Jan 16 19:00:02 2024 -0500

    pg_upgrade: Use gp_fatal_log for check output
    
    This ensures all checks will behave nicely with the
    --continue-check-on-fatal flag, per README.gpdb
---
 src/bin/pg_upgrade/check.c                | 50 +++++++++++++++++--------------
 src/bin/pg_upgrade/greenplum/version_gp.c | 13 ++++----
 src/bin/pg_upgrade/version.c              | 28 +++++++++++------
 3 files changed, 53 insertions(+), 38 deletions(-)

diff --git a/src/bin/pg_upgrade/check.c b/src/bin/pg_upgrade/check.c
index 00ff7def74..34331187be 100644
--- a/src/bin/pg_upgrade/check.c
+++ b/src/bin/pg_upgrade/check.c
@@ -580,7 +580,7 @@ check_for_new_tablespace_dir(ClusterInfo *new_cluster)
                                 new_cluster->tablespace_suffix);
 
                if (stat(new_tablespace_dir, &statbuf) == 0 || errno != ENOENT)
-                       pg_fatal("new cluster tablespace directory already 
exists: \"%s\"\n",
+                       gp_fatal_log("new cluster tablespace directory already 
exists: \"%s\"\n",
                                         new_tablespace_dir);
        }
 
@@ -941,13 +941,14 @@ check_proper_datallowconn(ClusterInfo *cluster)
        if (found)
        {
                pg_log(PG_REPORT, "fatal\n");
-               pg_fatal("All non-template0 databases must allow connections, 
i.e. their\n"
-                                "pg_database.datallowconn must be true.  Your 
installation contains\n"
-                                "non-template0 databases with their 
pg_database.datallowconn set to\n"
-                                "false.  Consider allowing connection for all 
non-template0 databases\n"
-                                "or drop the databases which do not allow 
connections.  A list of\n"
-                                "databases with the problem is in the file:\n"
-                                "    %s\n\n", output_path);
+               pg_fatal(
+                                "| All non-template0 databases must allow 
connections, i.e. their\n"
+                                "| pg_database.datallowconn must be true.  
Your installation contains\n"
+                                "| non-template0 databases with their 
pg_database.datallowconn set to\n"
+                                "| false.  Consider allowing connection for 
all non-template0 databases\n"
+                                "| or drop the databases which do not allow 
connections.  A list of\n"
+                                "| databases with the problem is in the 
file:\n"
+                                "|    %s\n\n", output_path);
        }
        else
                check_ok();
@@ -1303,12 +1304,13 @@ check_for_composite_data_type_usage(ClusterInfo 
*cluster)
        if (found)
        {
                pg_log(PG_REPORT, "fatal\n");
-               pg_fatal("Your installation contains system-defined composite 
type(s) in user tables.\n"
-                                "These type OIDs are not stable across 
PostgreSQL versions,\n"
-                                "so this cluster cannot currently be upgraded. 
 You can\n"
-                                "drop the problem columns and restart the 
upgrade.\n"
-                                "A list of the problem columns is in the 
file:\n"
-                                "    %s\n\n", output_path);
+               gp_fatal_log(
+                                "| Your installation contains system-defined 
composite type(s) in user tables.\n"
+                                "| These type OIDs are not stable across 
PostgreSQL versions,\n"
+                                "| so this cluster cannot currently be 
upgraded.  You can\n"
+                                "| drop the problem columns and restart the 
upgrade.\n"
+                                "| A list of the problem columns is in the 
file:\n"
+                                "|    %s\n\n", output_path);
        }
        else
                check_ok();
@@ -1397,12 +1399,13 @@ check_for_removed_data_type_usage(ClusterInfo *cluster, 
const char *version,
        if (check_for_data_type_usage(cluster, typename, output_path))
        {
                pg_log(PG_REPORT, "fatal\n");
-               pg_fatal("Your installation contains the \"%s\" data type in 
user tables.\n"
-                                "The \"%s\" type has been removed in 
PostgreSQL version %s,\n"
-                                "so this cluster cannot currently be upgraded. 
 You can drop the\n"
-                                "problem columns, or change them to another 
data type, and restart\n"
-                                "the upgrade.  A list of the problem columns 
is in the file:\n"
-                                "    %s\n\n", datatype, datatype, version, 
output_path);
+               gp_fatal_log(
+                               "| Your installation contains the \"%s\" data 
type in user tables.\n"
+                               "| The \"%s\" type has been removed in 
PostgreSQL version %s,\n"
+                               "| so this cluster cannot currently be 
upgraded.  You can drop the\n"
+                               "| problem columns, or change them to another 
data type, and restart\n"
+                               "| the upgrade.  A list of the problem columns 
is in the file:\n"
+                               "|    %s\n\n", datatype, datatype, version, 
output_path);
        }
        else
                check_ok();
@@ -1723,9 +1726,10 @@ 
check_for_appendonly_materialized_view_with_relfrozenxid(ClusterInfo *cluster)
 
        if(found)
        {
-               pg_fatal("Detected appendonly materialized view with incorrect 
relfrozenxid.\n"
-                                       "See %s for details.\n",
-                                       output_path);
+               gp_fatal_log(
+                               "| Detected appendonly materialized view with 
incorrect relfrozenxid.\n"
+                               "| A list of the problem materialized views are 
in the file:\n"
+                               "| %s\n\n", output_path);
        }
        else
        {
diff --git a/src/bin/pg_upgrade/greenplum/version_gp.c 
b/src/bin/pg_upgrade/greenplum/version_gp.c
index a737c19ab5..817d85e5b6 100644
--- a/src/bin/pg_upgrade/greenplum/version_gp.c
+++ b/src/bin/pg_upgrade/greenplum/version_gp.c
@@ -85,7 +85,7 @@ check_hash_partition_usage(void)
        {
                fclose(script);
                pg_log(PG_REPORT, "fatal\n");
-               pg_log(PG_FATAL,
+               gp_fatal_log(
                           "| Your installation contains hash partitioned 
tables.\n"
                           "| Upgrading hash partitioned tables is not 
supported,\n"
                           "| so this cluster cannot currently be upgraded.  
You\n"
@@ -242,11 +242,12 @@ 
old_GPDB6_check_for_unsupported_sha256_password_hashes(void)
        if (found)
        {
                pg_log(PG_REPORT, "fatal\n");
-               pg_fatal("Your installation contains roles with SHA-256 hashed 
passwords. Using\n"
-                                "SHA-256 for password hashes is no longer 
supported. You can use\n"
-                                "ALTER ROLE <role name> WITH PASSWORD NULL as 
superuser to clear passwords,\n"
-                                "and restart the upgrade.  A list of the 
problem roles is in the file:\n"
-                                "    %s\n\n", output_path);
+               gp_fatal_log(
+                                "| Your installation contains roles with 
SHA-256 hashed passwords. Using\n"
+                                "| SHA-256 for password hashes is no longer 
supported. You can use\n"
+                                "| ALTER ROLE <role name> WITH PASSWORD NULL 
as superuser to clear passwords,\n"
+                                "| and restart the upgrade.  A list of the 
problem roles is in the file:\n"
+                                "|    %s\n\n", output_path);
        }
        else
                check_ok();
diff --git a/src/bin/pg_upgrade/version.c b/src/bin/pg_upgrade/version.c
index e7b9aaea7f..36fbc3d170 100644
--- a/src/bin/pg_upgrade/version.c
+++ b/src/bin/pg_upgrade/version.c
@@ -323,7 +323,7 @@ old_9_6_check_for_unknown_data_type_usage(ClusterInfo 
*cluster)
        if (check_for_data_type_usage(cluster, "pg_catalog.unknown", 
output_path))
        {
                pg_log(PG_REPORT, "fatal\n");
-               pg_fatal("Your installation contains the \"unknown\" data type 
in user tables.\n"
+               gp_fatal_log("Your installation contains the \"unknown\" data 
type in user tables.\n"
                                 "This data type is no longer allowed in 
tables, so this\n"
                                 "cluster cannot currently be upgraded.  You 
can\n"
                                 "drop the problem columns and restart the 
upgrade.\n"
@@ -467,12 +467,22 @@ 
old_11_check_for_sql_identifier_data_type_usage(ClusterInfo *cluster)
                                                                  output_path))
        {
                pg_log(PG_REPORT, "fatal\n");
-               pg_fatal("Your installation contains the \"sql_identifier\" 
data type in user tables.\n"
+<<<<<<< HEAD
+               gp_fatal_log("Your installation contains the \"sql_identifier\" 
data type in user tables.\n"
                                 "The on-disk format for this data type has 
changed, so this\n"
                                 "cluster cannot currently be upgraded.  You 
can\n"
                                 "drop the problem columns and restart the 
upgrade.\n"
                                 "A list of the problem columns is in the 
file:\n"
                                 "    %s\n\n", output_path);
+=======
+               gp_fatal_log(
+                               "| Your installation contains the 
\"sql_identifier\" data type in user tables\n"
+                               "| and/or indexes.  The on-disk format for this 
data type has changed, so this\n"
+                               "| cluster cannot currently be upgraded.  You 
can remove the problem tables or\n"
+                               "| change the data type to \"name\" and restart 
the upgrade.\n"
+                               "| A list of the problem columns is in the 
file:\n"
+                               "|    %s\n\n", output_path);
+>>>>>>> c9a80399044 (pg_upgrade: Use gp_fatal_log for check output)
        }
        else
                check_ok();
@@ -544,13 +554,13 @@ report_extension_updates(ClusterInfo *cluster)
        if (found)
        {
                report_status(PG_REPORT, "notice");
-               pg_log(PG_REPORT, "\n"
-                          "Your installation contains extensions that should 
be updated\n"
-                          "with the ALTER EXTENSION command.  The file\n"
-                          "    %s\n"
-                          "when executed by psql by the database superuser 
will update\n"
-                          "these extensions.\n\n",
-                          output_path);
+               gp_fatal_log(
+                               "| Your installation contains extensions that 
should be updated\n"
+                               "| with the ALTER EXTENSION command.  The 
file\n"
+                               "|     %s\n"
+                               "| when executed by psql by the database 
superuser will update\n"
+                               "| these extensions.\n\n",
+                               output_path);
        }
        else
                check_ok();


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to