You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudberry.apache.org by ma...@apache.org on 2024/12/26 08:23:11 UTC

(cloudberry) 13/13: pg_upgrade: Fix core dump in report_progress()

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

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

commit 8d20831b7c8b8e3f464eb6a4045beacc562fc442
Author: Brent Doil <bd...@vmware.com>
AuthorDate: Thu Sep 8 15:04:17 2022 -0400

    pg_upgrade: Fix core dump in report_progress()
    
    The report_progress function may take a NULL argument
    for cluster, but was not checking it before trying to
    print cluster->major_version_str, resulting in a core
    dump.
    
    Add a check before fprintf call, which also resolves a FIXME.
    
    Also use --progress flag in pg_upgrade regression test.
    
    Authored-by: Brent Doil <bd...@vmware.com>
---
 src/bin/pg_upgrade/greenplum/reporting.c | 14 ++++++++------
 src/bin/pg_upgrade/test_gpdb.sh          |  2 +-
 2 files changed, 9 insertions(+), 7 deletions(-)

diff --git a/src/bin/pg_upgrade/greenplum/reporting.c b/src/bin/pg_upgrade/greenplum/reporting.c
index bf6ed4fee7..30022f55eb 100644
--- a/src/bin/pg_upgrade/greenplum/reporting.c
+++ b/src/bin/pg_upgrade/greenplum/reporting.c
@@ -94,13 +94,15 @@ report_progress(ClusterInfo *cluster, progress_type op, char *fmt,...)
 	}
 
 	/*
-	 * GPDB_12_MERGE_FIXME: The CLUSTER_NAME macro was removed, so we've
-	 * changed to printing the major version of the cluster instead. This may
-	 * well be good enough (or even better), but some more thought should go
-	 * into this before calling it done.
+	 * In the case where cluster is NULL, omit the cluster version in
+	 * the progress file.
 	 */
-	fprintf(progress_file, "%lu;%s;%s;%s;\n",
-			epoch_us(), cluster->major_version_str, opname(op), message);
+	if (cluster && *cluster->major_version_str != '\0')
+		fprintf(progress_file, "%lu;%s;%s;%s;\n",
+				epoch_us(), cluster->major_version_str, opname(op), message);
+	else
+		fprintf(progress_file, "%lu;%s;%s;\n", epoch_us(), opname(op), message);
+
 	progress_counter++;
 
 	/*
diff --git a/src/bin/pg_upgrade/test_gpdb.sh b/src/bin/pg_upgrade/test_gpdb.sh
index 798ac91c63..d8dd53742a 100755
--- a/src/bin/pg_upgrade/test_gpdb.sh
+++ b/src/bin/pg_upgrade/test_gpdb.sh
@@ -172,7 +172,7 @@ upgrade_qd()
 
 	# Run pg_upgrade
 	pushd $1
-	time ${NEW_BINDIR}/pg_upgrade --mode=dispatcher --old-bindir=${OLD_BINDIR} --old-datadir=$2 --new-bindir=${NEW_BINDIR} --new-datadir=$3 ${PGUPGRADE_OPTS}
+	time ${NEW_BINDIR}/pg_upgrade --mode=dispatcher --progress --old-bindir=${OLD_BINDIR} --old-datadir=$2 --new-bindir=${NEW_BINDIR} --new-datadir=$3 ${PGUPGRADE_OPTS}
 	if (( $? )) ; then
 		echo "ERROR: Failure encountered in upgrading qd node"
 		exit 1


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cloudberry.apache.org
For additional commands, e-mail: commits-help@cloudberry.apache.org