aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorDaniel Gustafsson <dgustafsson@postgresql.org>2023-07-20 14:55:50 +0200
committerDaniel Gustafsson <dgustafsson@postgresql.org>2023-07-20 14:55:50 +0200
commita3f695e645d0363d845a828db45deac5af1b4c0e (patch)
treebf2500443bb0e581aa3e9911f75981d0f0c71a4d /src
parent3c152a27b06313fe27bd47079658f928e291986b (diff)
downloadpostgresql-a3f695e645d0363d845a828db45deac5af1b4c0e.tar.gz
postgresql-a3f695e645d0363d845a828db45deac5af1b4c0e.zip
pg_upgrade: include additional detail in cluster check
When the cluster failed the pg_controldata check for clean shut down we only reported that it did so, not why. The state of the cluster can be important information when diagnosing the failed upgrade attempt, so instead include it in the error message. Discussion: https://postgr.es/m/E0D5EA16-A085-4753-8DDC-C7055048B439@yesql.se
Diffstat (limited to 'src')
-rw-r--r--src/bin/pg_upgrade/controldata.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/src/bin/pg_upgrade/controldata.c b/src/bin/pg_upgrade/controldata.c
index 9071a6fd457..4beb65ab220 100644
--- a/src/bin/pg_upgrade/controldata.c
+++ b/src/bin/pg_upgrade/controldata.c
@@ -149,22 +149,23 @@ get_control_data(ClusterInfo *cluster, bool live_check)
* the server was shut down cleanly, from the controldata
* perspective.
*/
- /* remove leading spaces */
+ /* Remove trailing newline and leading spaces */
+ (void) pg_strip_crlf(p);
while (*p == ' ')
p++;
- if (strcmp(p, "shut down in recovery\n") == 0)
+ if (strcmp(p, "shut down in recovery") == 0)
{
if (cluster == &old_cluster)
pg_fatal("The source cluster was shut down while in recovery mode. To upgrade, use \"rsync\" as documented or shut it down as a primary.");
else
pg_fatal("The target cluster was shut down while in recovery mode. To upgrade, use \"rsync\" as documented or shut it down as a primary.");
}
- else if (strcmp(p, "shut down\n") != 0)
+ else if (strcmp(p, "shut down") != 0)
{
if (cluster == &old_cluster)
- pg_fatal("The source cluster was not shut down cleanly.");
+ pg_fatal("The source cluster was not shut down cleanly, state reported as: \"%s\"", p);
else
- pg_fatal("The target cluster was not shut down cleanly.");
+ pg_fatal("The target cluster was not shut down cleanly, state reported as: \"%s\"", p);
}
got_cluster_state = true;
}