mirror of
https://github.com/EnterpriseDB/repmgr.git
synced 2026-03-22 22:56:29 +00:00
standby clone: always ensure directory is created with correct permissions
In Barman mode, if there is an existing, populated data directory, and the "--force" option is provided, the entire directory was being deleted, and later recreated as part of the rsync process, but with the default permissions. Fix this by recreating the data directory with the correct permissions after deleting it.
This commit is contained in:
2
HISTORY
2
HISTORY
@@ -2,6 +2,8 @@
|
||||
repmgr: ensure BDR2-specific functionality cannot be used on
|
||||
BDR3 and later (Ian)
|
||||
repmgr: improve --dry-run behaviour in barman mode (Ian)
|
||||
repmgr: fix data directory permissions issue in barman mode where
|
||||
an existing directory is being overwritten (Ian)
|
||||
|
||||
4.3 2019-04-02
|
||||
repmgr: add "daemon (start|stop)" command; GitHub #528 (Ian)
|
||||
|
||||
18
dirutil.c
18
dirutil.c
@@ -336,6 +336,15 @@ create_pg_dir(const char *path, bool force)
|
||||
{
|
||||
log_notice(_("-F/--force provided - deleting existing data directory \"%s\""), path);
|
||||
nftw(path, unlink_dir_callback, 64, FTW_DEPTH | FTW_PHYS);
|
||||
|
||||
/* recreate the directory ourselves to ensure permissions are correct */
|
||||
if (!create_dir(path))
|
||||
{
|
||||
log_error(_("unable to create directory \"%s\"..."),
|
||||
path);
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -347,6 +356,15 @@ create_pg_dir(const char *path, bool force)
|
||||
{
|
||||
log_notice(_("deleting existing directory \"%s\""), path);
|
||||
nftw(path, unlink_dir_callback, 64, FTW_DEPTH | FTW_PHYS);
|
||||
|
||||
/* recreate the directory ourselves to ensure permissions are correct */
|
||||
if (!create_dir(path))
|
||||
{
|
||||
log_error(_("unable to create directory \"%s\"..."),
|
||||
path);
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
||||
@@ -46,6 +46,14 @@
|
||||
</para>
|
||||
</listitem>
|
||||
|
||||
<listitem>
|
||||
<para>
|
||||
&repmgr;: when executing <link linkend="repmgr-standby-clone"><command>repmgr standby clone</command></link>
|
||||
in <option>--dry-run</option> mode, ensure provision of the <option>--force</option> option
|
||||
does not result in an existing data directory being modified in any way.
|
||||
</para>
|
||||
</listitem>
|
||||
|
||||
</itemizedlist>
|
||||
</para>
|
||||
</sect2>
|
||||
|
||||
Reference in New Issue
Block a user