Delete any replication slots copied by pg_rewind

If --force-rewind is used in conjunction with "repmgr node rejoin",
any replication slots present on the source node will be copied too;
it's essential to remove these to prevent stale slots being extant
when the node starts up.

We do this at file system level *before* the server starts to minimize
the risk of any problems.

Addresses GitHub #334
This commit is contained in:
Ian Barwick
2017-11-24 11:11:24 +09:00
parent da93dd1f57
commit 3a8ee126f3
3 changed files with 67 additions and 6 deletions

View File

@@ -311,6 +311,14 @@ create_pg_dir(char *path, bool force)
return true;
}
int
rmdir_recursive(char *path)
{
return nftw(path, unlink_dir_callback, 64, FTW_DEPTH | FTW_PHYS);
}
static int
unlink_dir_callback(const char *fpath, const struct stat *sb, int typeflag, struct FTW *ftwbuf)
{