From f1584469bf49dcda4f082633a24f9c5e96559ad3 Mon Sep 17 00:00:00 2001 From: Gianni Ciolli Date: Tue, 11 Aug 2015 14:59:23 +0200 Subject: [PATCH] Bug #97 fix (standby clone --force does not empty pg_xlog). --- repmgr.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/repmgr.c b/repmgr.c index 23e7d69a..2233d62b 100644 --- a/repmgr.c +++ b/repmgr.c @@ -1449,6 +1449,24 @@ stop_backup: exit(retval); } + /* + * Remove existing WAL from the target directory, since + * rsync's --exclude option doesn't do it. + */ + if (runtime_options.force) + { + char script[MAXLEN]; + maxlen_snprintf(script, "rm -rf %s/pg_xlog/*", + local_data_directory); + r = system(script); + if (r != 0) + { + log_err(_("unable to empty local WAL directory %s/pg_xlog/\n"), + local_data_directory); + exit(ERR_BAD_RSYNC); + } + } + /* Finally, write the recovery.conf file */ create_recovery_file(local_data_directory);