standby clone: minimize requirement to check upstream data directory location

repmgr has always insisted on determining the upstream's data directory
location, which requires superuser permissions (or from PostgreSQL 10,
membership of the default role "pg_read_all_settings").

Knowledge of the data directory location was required to implement rsync
cloning (now deprecated), but with pg_basebackup the minimum permission
requirement is now only a normal user with access to the repmgr metadata
and a user with replication permissions. The ability to determine the
data directory location is only required if the user specifies the
--copy-external-config-files option, which needs to be able to determine
the data directory to work out which configuration files are located
outside it.

This patch makes it possible to clone a standby with minimum
permissions, with appropriate checks for available permissions if
--copy-external-config-files is provided.

Implements part of GitHub #536 and addresses issue raised in #586.
This commit is contained in:
Ian Barwick
2019-10-23 10:46:16 +09:00
parent d7fd55be99
commit be494f0d5f
4 changed files with 89 additions and 10 deletions

View File

@@ -19,6 +19,14 @@
#ifndef _REPMGR_ACTION_STANDBY_H_
#define _REPMGR_ACTION_STANDBY_H_
typedef enum
{
REPMGR_USER = 0,
REPLICATION_USER,
REPLICATION_PROTOCOL_USER,
SUPERUSER
} t_user_type;
extern void do_standby_clone(void);
extern void do_standby_register(void);
extern void do_standby_unregister(void);