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 9317bee82860de88eead956f86938a18dcebb524
Author: Brent Doil <[email protected]>
AuthorDate: Thu Jan 25 00:11:58 2024 -0500

    Ensure check output files land in the same location
---
 src/bin/pg_upgrade/check.c                | 18 ++++++++++++------
 src/bin/pg_upgrade/greenplum/check_gp.c   | 13 +++++++++----
 src/bin/pg_upgrade/greenplum/version_gp.c |  6 ++++--
 src/bin/pg_upgrade/version.c              |  7 +++++--
 4 files changed, 30 insertions(+), 14 deletions(-)

diff --git a/src/bin/pg_upgrade/check.c b/src/bin/pg_upgrade/check.c
index 36424f57ff..f238796a51 100644
--- a/src/bin/pg_upgrade/check.c
+++ b/src/bin/pg_upgrade/check.c
@@ -264,7 +264,7 @@ report_clusters_compatible(void)
                                pg_fatal("could not determine current 
directory: %m\n");
                        canonicalize_path(cwd);
 
-                       pg_log(PG_REPORT, "\n*Some cluster objects are not 
compatible*\n\npg_upgrade check output files are located:\n%s\n\n", cwd);
+                       pg_log(PG_REPORT, "\n*Some cluster objects are not 
compatible*\n\npg_upgrade check output files are located in:\n%s\n\n", 
log_opts.basedir);
                } else
                        pg_log(PG_REPORT, "\n*Clusters are compatible*\n");
 
@@ -1279,8 +1279,9 @@ check_for_composite_data_type_usage(ClusterInfo *cluster)
 
        prep_status("Checking for system-defined composite types in user 
tables");
 
-       snprintf(output_path, sizeof(output_path), 
"tables_using_composite.txt");
-
+       snprintf(output_path, sizeof(output_path), "%s/%s",
+                        log_opts.basedir,
+                        "tables_using_composite.txt");
        /*
         * Look for composite types that were made during initdb *or* belong to
         * information_schema; that's important in case information_schema was
@@ -1337,7 +1338,9 @@ check_for_reg_data_type_usage(ClusterInfo *cluster)
 
        prep_status("Checking for reg* data types in user tables");
 
-       snprintf(output_path, sizeof(output_path), "tables_using_reg.txt");
+       snprintf(output_path, sizeof(output_path), "%s/%s",
+                        log_opts.basedir,
+                        "tables_using_reg.txt");
 
        /*
         * Note: older servers will not have all of these reg* types, so we have
@@ -1394,7 +1397,8 @@ check_for_removed_data_type_usage(ClusterInfo *cluster, 
const char *version,
        prep_status("Checking for removed \"%s\" data type in user tables",
                                datatype);
 
-       snprintf(output_path, sizeof(output_path), "tables_using_%s.txt",
+       snprintf(output_path, sizeof(output_path), "%s/tables_using_%s.txt",
+                        log_opts.basedir,
                         datatype);
        snprintf(typename, sizeof(typename), "pg_catalog.%s", datatype);
 
@@ -1426,7 +1430,9 @@ check_for_jsonb_9_4_usage(ClusterInfo *cluster)
 
        prep_status("Checking for incompatible \"jsonb\" data type");
 
-       snprintf(output_path, sizeof(output_path), "tables_using_jsonb.txt");
+       snprintf(output_path, sizeof(output_path), "%s/%s",
+                        log_opts.basedir,
+                        "tables_using_jsonb.txt");
 
        if (check_for_data_type_usage(cluster, "pg_catalog.jsonb", output_path))
        {
diff --git a/src/bin/pg_upgrade/greenplum/check_gp.c 
b/src/bin/pg_upgrade/greenplum/check_gp.c
index fed66b2bf1..37ec7e0c72 100644
--- a/src/bin/pg_upgrade/greenplum/check_gp.c
+++ b/src/bin/pg_upgrade/greenplum/check_gp.c
@@ -153,7 +153,9 @@ check_external_partition(void)
 
        prep_status("Checking for external tables used in partitioning");
 
-       snprintf(output_path, sizeof(output_path), "external_partitions.txt");
+       snprintf(output_path, sizeof(output_path), "%s/%s",
+                        log_opts.basedir, "external_partitions.txt");
+
        /*
         * We need to query the inheritance catalog rather than the partitioning
         * catalogs since they are not available on the segments.
@@ -260,7 +262,8 @@ check_covering_aoindex(void)
 
        prep_status("Checking for non-covering indexes on partitioned AO 
tables");
 
-       snprintf(output_path, sizeof(output_path), 
"mismatched_aopartition_indexes.txt");
+       snprintf(output_path, sizeof(output_path), "%s/%s",
+                        log_opts.basedir, 
"mismatched_aopartition_indexes.txt");
 
        for (dbnum = 0; dbnum < old_cluster.dbarr.ndbs; dbnum++)
        {
@@ -331,7 +334,8 @@ check_orphaned_toastrels(void)
 
        prep_status("Checking for orphaned TOAST relations");
 
-       snprintf(output_path, sizeof(output_path), "orphaned_toast_tables.txt");
+       snprintf(output_path, sizeof(output_path), "%s/%s",
+                        log_opts.basedir, "orphaned_toast_tables.txt");
 
        for (dbnum = 0; dbnum < old_cluster.dbarr.ndbs; dbnum++)
        {
@@ -414,7 +418,8 @@ check_partition_indexes(void)
 
        prep_status("Checking for indexes on partitioned tables");
 
-       snprintf(output_path, sizeof(output_path), 
"partitioned_tables_indexes.txt");
+       snprintf(output_path, sizeof(output_path), "%s/%s",
+                        log_opts.basedir, "partitioned_tables_indexes.txt");
 
        for (dbnum = 0; dbnum < old_cluster.dbarr.ndbs; dbnum++)
        {
diff --git a/src/bin/pg_upgrade/greenplum/version_gp.c 
b/src/bin/pg_upgrade/greenplum/version_gp.c
index 817d85e5b6..6591fc6e6c 100644
--- a/src/bin/pg_upgrade/greenplum/version_gp.c
+++ b/src/bin/pg_upgrade/greenplum/version_gp.c
@@ -39,7 +39,8 @@ check_hash_partition_usage(void)
 
        prep_status("Checking for hash partitioned tables");
 
-       snprintf(output_path, sizeof(output_path), 
"hash_partitioned_tables.txt");
+       snprintf(output_path, sizeof(output_path), "%s/%s",
+                        log_opts.basedir, "hash_partitioned_tables.txt");
 
        for (dbnum = 0; dbnum < old_cluster.dbarr.ndbs; dbnum++)
        {
@@ -204,7 +205,8 @@ old_GPDB6_check_for_unsupported_sha256_password_hashes(void)
 
        prep_status("Checking for SHA-256 hashed passwords");
 
-       snprintf(output_path, sizeof(output_path), 
"roles_using_sha256_passwords.txt");
+       snprintf(output_path, sizeof(output_path), "%s/%s",
+                        log_opts.basedir, "roles_using_sha256_passwords.txt");
 
        /* It's enough to check this in one database, pg_authid is a shared 
catalog. */
        {
diff --git a/src/bin/pg_upgrade/version.c b/src/bin/pg_upgrade/version.c
index 36fbc3d170..d873abf0c5 100644
--- a/src/bin/pg_upgrade/version.c
+++ b/src/bin/pg_upgrade/version.c
@@ -318,7 +318,9 @@ old_9_6_check_for_unknown_data_type_usage(ClusterInfo 
*cluster)
 
        prep_status("Checking for invalid \"unknown\" user columns");
 
-       snprintf(output_path, sizeof(output_path), "tables_using_unknown.txt");
+       snprintf(output_path, sizeof(output_path), "%s/%s",
+                                log_opts.basedir,
+                                "tables_using_unknown.txt");
 
        if (check_for_data_type_usage(cluster, "pg_catalog.unknown", 
output_path))
        {
@@ -461,7 +463,8 @@ old_11_check_for_sql_identifier_data_type_usage(ClusterInfo 
*cluster)
 
        prep_status("Checking for invalid \"sql_identifier\" user columns");
 
-       snprintf(output_path, sizeof(output_path), 
"tables_using_sql_identifier.txt");
+       snprintf(output_path, sizeof(output_path), "%s/%s",
+                        log_opts.basedir, "tables_using_sql_identifier.txt");
 
        if (check_for_data_type_usage(cluster, 
"information_schema.sql_identifier",
                                                                  output_path))


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

Reply via email to