Skip to content

Commit

Permalink
pg_upgrade: Fix core dump in report_progress()
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
bmdoil authored and my-ship-it committed Dec 26, 2024
1 parent 5c173c6 commit 8d20831
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
14 changes: 8 additions & 6 deletions src/bin/pg_upgrade/greenplum/reporting.c
Original file line number Diff line number Diff line change
Expand Up @@ -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++;

/*
Expand Down
2 changes: 1 addition & 1 deletion src/bin/pg_upgrade/test_gpdb.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 8d20831

Please sign in to comment.