postgres.git / summary / log / commit / refs

commit    a49cf6ef3d0c0e90b0c69d34c829488d3fbe7638
Author:   Bruce Momjian <bruce@momjian.us>
Date:     Fri Aug 17 14:25:48 2018 +0000

    pg_upgrade:  issue helpful error message for use on standbys
    
    Commit 777e6ddf1723306bd2bf8fe6f804863f459b0323 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


contrib/pg_upgrade/controldata.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/contrib/pg_upgrade/controldata.c b/contrib/pg_upgrade/controldata.c index e3386f81019..2c1c69b6fae 100644 --- a/contrib/pg_upgrade/controldata.c +++ b/contrib/pg_upgrade/controldata.c @@ -148,8 +148,14 @@ get_control_data(ClusterInfo *cluster, bool live_check) /* remove leading spaces */ while (*p == ' ') p++; - if (strcmp(p, "shut down\n") != 0 && - strcmp(p, "shut down in recovery\n") != 0) + if (strcmp(p, "shut down in recovery\n") == 0) + { + if (cluster == &old_cluster) + 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"); + else + 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"); + } + else if (strcmp(p, "shut down\n") != 0) { if (cluster == &old_cluster) pg_log(PG_FATAL, "The source cluster was not shut down cleanly.\n"); [parent: b6c994af1f0d]