From f82418969201ffc585b5090ccce526a8c8134e1b Mon Sep 17 00:00:00 2001 From: Greg Smith Date: Tue, 5 Apr 2011 17:52:39 -0400 Subject: [PATCH] Cleanup new ignore rsync warning feature. Closes gh-22. --- HISTORY | 4 ++-- README.rst | 2 +- repmgr.c | 26 +++++++++++++++----------- 3 files changed, 18 insertions(+), 14 deletions(-) diff --git a/HISTORY b/HISTORY index bb6ddadc..460c5d2c 100644 --- a/HISTORY +++ b/HISTORY @@ -31,5 +31,5 @@ 1.1.0 2011-03-09 Make options -U, -R and -p not mandatory (Jaime) -X.X.X 2011-XX-XX - Add --ignore-rsync-warning (Cédric) +1.1.1 2011-XX-XX + Add --ignore-rsync-warning (Cédric) diff --git a/README.rst b/README.rst index 04178120..18b487bf 100644 --- a/README.rst +++ b/README.rst @@ -862,8 +862,8 @@ The output from this program looks like this:: -f, --config_file=PATH path to the configuration file -R, --remote-user=USERNAME database server username for rsync -w, --wal-keep-segments=VALUE minimum value for the GUC wal_keep_segments (default: 5000) + -I, --ignore-rsync-warning ignore rsync partial transfer warning -F, --force force potentially dangerous operations to happen - -I, --ignore-rsync-warning Ignore partial transfert warning repmgr performs some tasks like clone a node, promote it or making follow another node and then exits. COMMANDS: diff --git a/repmgr.c b/repmgr.c index e53455d2..e493b128 100644 --- a/repmgr.c +++ b/repmgr.c @@ -1340,8 +1340,8 @@ void help(const char *progname) printf(_(" -f, --config_file=PATH path to the configuration file\n")); printf(_(" -R, --remote-user=USERNAME database server username for rsync\n")); printf(_(" -w, --wal-keep-segments=VALUE minimum value for the GUC wal_keep_segments (default: 5000)\n")); + printf(_(" -I, --ignore-rsync-warning ignore rsync partial transfer warning\n")); printf(_(" -F, --force force potentially dangerous operations to happen\n")); - printf(_(" -I, --ignore-rsync-warning Ignore partial transfert warning\n")); printf(_("\n%s performs some tasks like clone a node, promote it "), progname); printf(_("or making follow another node and then exits.\n")); @@ -1479,24 +1479,28 @@ copy_remote_files(char *host, char *remote_user, char *remote_path, r = system(script); /* - * If we are transfering a directory (ie: data directory, tablespace directories) - * then we can ignore some rsync warning, so if we get some of those errors we - * treat them as 0 if we have --ignore-rsync-warning commandline option set + * If we are transfering a directory (data directory, tablespace directories) + * then we can ignore some rsync warnings. If we get some of those errors, we + * treat them as 0 only if passed the --ignore-rsync-warning command-line option. + * * List of ignorable rsync errors: - * 24 Partial transfer due to vanished source files + * 24 Partial transfer due to vanished source files */ if ((WEXITSTATUS(r) == 24) && is_directory) { - if (!runtime_options.ignore_rsync_warn) - log_warning( _("\nrsync completed with return code 24 " + if (runtime_options.ignore_rsync_warn) + { + r = 0; + log_info(_("rsync partial transfer warning ignored\n")); + } + else + log_warning( _("\nrsync completed with return code 24: " "\"Partial transfer due to vanished source files\".\n" "This can happen because of normal operation " "on the master server, but it may indicate an " - "issue during cloning. If you are certain no " - "changes were made to the master, try cloning " + "unexpected change during cloning. If you are certain " + "no changes were made to the master, try cloning " "again using \"repmgr --force --ignore-rsync-warning\".")); - else - r = 0; } if (r != 0) log_err(_("Can't rsync from remote file or directory (%s:%s)\n"),