From 7e7c45c61d504adfdb6203b38ab03e94a5c687b0 Mon Sep 17 00:00:00 2001 From: Charles Duffy Date: Sun, 6 Feb 2011 15:05:34 -0600 Subject: [PATCH] exit with status 2 if manual work is needed during standby_clone --- repmgr.c | 31 +++++++++++++++++-------------- repmgr.h | 1 + 2 files changed, 18 insertions(+), 14 deletions(-) diff --git a/repmgr.c b/repmgr.c index 10fa936f..606f57fa 100644 --- a/repmgr.c +++ b/repmgr.c @@ -970,30 +970,33 @@ stop_backup: /* If the rsync failed then exit */ if (r != 0) - exit(ERR_BAD_CONFIG); + exit(ERR_BAD_RSYNC); if (runtime_options.verbose) printf(_("%s requires primary to keep WAL files %s until at least %s\n"), progname, first_wal_segment, last_wal_segment); - /* we need to create the pg_xlog sub directory too, i'm reusing a variable here */ - snprintf(local_control_file, MAXFILENAME, "%s/pg_xlog", runtime_options.dest_dir); - if (!create_directory(local_control_file)) - { - log_err(_("%s: couldn't create directory %s, you will need to do it manually...\n"), - progname, runtime_options.dest_dir); - } - - /* Finally, write the recovery.conf file */ - create_recovery_file(runtime_options.dest_dir); - + /* we need to create the pg_xlog sub directory too, i'm reusing a variable here */ + snprintf(local_control_file, MAXFILENAME, "%s/pg_xlog", runtime_options.dest_dir); + if (!create_directory(local_control_file)) + { + log_err(_("%s: couldn't create directory %s, you will need to do it manually...\n"), + progname, runtime_options.dest_dir); + r = ERR_NEEDS_XLOG; /* continue, but eventually exit returning error */ } + /* Finally, write the recovery.conf file */ + create_recovery_file(runtime_options.dest_dir); + PQclear(res); PQfinish(conn); - /* We don't start the service because we still may want to move the directory */ - return; + /* + * We don't start the service yet because we still may want to + * move the directory + */ + + exit(r); } diff --git a/repmgr.h b/repmgr.h index 55c08835..6267e028 100644 --- a/repmgr.h +++ b/repmgr.h @@ -51,6 +51,7 @@ #define ERR_BAD_RSYNC 2 #define ERR_STOP_BACKUP 3 #define ERR_NO_RESTART 4 +#define ERR_NEEDS_XLOG 5 /* Run time options type */ typedef struct {