Skip to content

Commit a49cf6e

Browse files
committed
pg_upgrade: issue helpful error message for use on standbys
Commit 777e6dd checked for a shut down message from a standby and allowed it to continue. This patch reports a helpful error message in these cases, suggesting to use rsync as documented. Diagnosed-by: Martín Marqués Discussion: https://postgr.es/m/CAPdiE1xYCow-reLjrhJ9DqrMu-ppNq0ChUUEvVdxhdjGRD5_eA@mail.gmail.com Backpatch-through: 9.3
1 parent b6c994a commit a49cf6e

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

contrib/pg_upgrade/controldata.c

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -148,8 +148,14 @@ get_control_data(ClusterInfo *cluster, bool live_check)
148148
/* remove leading spaces */
149149
while (*p == ' ')
150150
p++;
151-
if (strcmp(p, "shut down\n") != 0 &&
152-
strcmp(p, "shut down in recovery\n") != 0)
151+
if (strcmp(p, "shut down in recovery\n") == 0)
152+
{
153+
if (cluster == &old_cluster)
154+
pg_log(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.\n");
155+
else
156+
pg_log(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.\n");
157+
}
158+
else if (strcmp(p, "shut down\n") != 0)
153159
{
154160
if (cluster == &old_cluster)
155161
pg_log(PG_FATAL, "The source cluster was not shut down cleanly.\n");

0 commit comments

Comments
 (0)