standby clone: fix data directory permissions handling for Pg11 and later

Previously, repmgr would forcibly change the permissions on a data
directory to 0700. However from PostgreSQL 11, 0750 is also valid,
so that value should not be changed.
This commit is contained in:
Ian Barwick
2020-12-01 11:42:56 +09:00
parent 53774d6998
commit 7cee09dd95
5 changed files with 88 additions and 10 deletions

View File

@@ -838,6 +838,16 @@ do_standby_clone(void)
break;
}
/*
* Do a final check on the data directory permissions - if the user
* is cloning into an existing directory set to 0750, and the server
* is Pg10 or earlier, Pg will refuse to start. We might not have
* known the server version when creating the data directory
* (mainly if cloning from Barman with no upstream connection), hence
* the additional check here.
*/
set_dir_permissions(local_data_directory, source_server_version_num);
/*
* TODO: It might be nice to provide an option to have repmgr start the
* PostgreSQL server automatically