Consolidate generation of various server control commands

This is needed for better switchover control, so we can instruct
the remote repmgr to issue the appropriate server command rather
than trying to work out what it should be from the local node.
This commit is contained in:
Ian Barwick
2017-08-02 12:01:20 +09:00
parent 5b7b276ada
commit aa528dfdfb
8 changed files with 397 additions and 51 deletions

View File

@@ -50,12 +50,12 @@ typedef struct
char remote_user[MAXLEN];
char superuser[MAXLEN];
/* node options */
/* general node options */
int node_id;
char node_name[MAXLEN];
char data_dir[MAXPGPATH];
/* standby clone options */
/* "standby clone" options */
bool copy_external_config_files;
int copy_external_config_files_destination;
bool fast_checkpoint;
@@ -69,11 +69,16 @@ typedef struct
char wal_keep_segments[MAXLEN];
bool without_barman;
/* standby register options */
/* "standby register" options */
bool wait_register_sync;
int wait_register_sync_seconds;
/* event options */
/* "node service" options */
char action[MAXLEN];
bool check;
bool list;
/* "cluster event" options */
bool all;
char event[MAXLEN];
int limit;
@@ -97,11 +102,13 @@ typedef struct
"", "", \
/* node options */ \
UNKNOWN_NODE_ID, "", "", \
/* standby clone options */ \
/* "standby clone" options */ \
false, CONFIG_FILE_SAMEPATH, false, false, false, "", "", "", NO_UPSTREAM_NODE, false, "", false, \
/* standby register options */ \
/* "standby register" options */ \
false, 0, \
/* event options */ \
/* "node service" options */ \
"", false, false, \
/* "cluster event" options */ \
false, "", CLUSTER_EVENT_LIMIT, \
"/tmp" \
}
@@ -112,6 +119,17 @@ typedef enum {
pg_basebackup
} standy_clone_mode;
typedef enum {
ACTION_UNKNOWN = -1,
ACTION_NONE,
ACTION_START,
ACTION_STOP,
ACTION_RESTART,
ACTION_RELOAD,
ACTION_PROMOTE
} t_server_action;
/* global configuration structures */
extern t_runtime_options runtime_options;
@@ -149,4 +167,8 @@ extern void get_superuser_connection(PGconn **conn, PGconn **superuser_conn, PGc
extern bool remote_command(const char *host, const char *user, const char *command, PQExpBufferData *outputbuf);
/* server control functions */
extern void get_server_action(t_server_action action, char *script, char *data_dir);
#endif