From f0588334510bbb41f2f5e3d1601805159f820577 Mon Sep 17 00:00:00 2001 From: Ian Barwick Date: Wed, 19 Oct 2016 10:00:50 +0900 Subject: [PATCH] repmgr: in Barman clone mode, don't try and create the data directory twice In Barman mode the data directory is created early containing a temporary directory needed to hold temporary files while cloning from the Barman server. In other modes we might not know the data directory location until connecting to the source server, so its creation happens later. In Barman mode ensure that step is skipped. --- repmgr.c | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/repmgr.c b/repmgr.c index c84c6a8d..11a4c1d9 100644 --- a/repmgr.c +++ b/repmgr.c @@ -2901,18 +2901,23 @@ do_standby_clone(void) } - /* Check the destination data directory can be used */ - - if (!create_pg_dir(local_data_directory, runtime_options.force)) - { - log_err(_("unable to use directory %s ...\n"), - local_data_directory); - log_hint(_("use -F/--force option to force this directory to be overwritten\n")); - exit(ERR_BAD_CONFIG); - } if (mode != barman) { + + /* + * Check the destination data directory can be used + * (in Barman mode, this directory will already have been created) + */ + + if (!create_pg_dir(local_data_directory, runtime_options.force)) + { + log_err(_("unable to use directory %s ...\n"), + local_data_directory); + log_hint(_("use -F/--force option to force this directory to be overwritten\n")); + exit(ERR_BAD_CONFIG); + } + /* * Check that tablespaces named in any `tablespace_mapping` configuration * file parameters exist.