No need to expose configuration file archive functions as repmgr commands

This commit is contained in:
Ian Barwick
2017-08-09 13:32:15 +09:00
parent df425a38b7
commit bae82318f1
4 changed files with 13 additions and 32 deletions

View File

@@ -26,6 +26,8 @@ static t_server_action parse_server_action(const char *action);
static void _do_node_service_check(void); static void _do_node_service_check(void);
static void _do_node_service_list_actions(t_server_action action); static void _do_node_service_list_actions(t_server_action action);
static void _do_node_status_is_shutdown(void); static void _do_node_status_is_shutdown(void);
static void _do_node_archive_config(void);
static void _do_node_restore_config(void);
void void
do_node_status(void) do_node_status(void)
@@ -1008,8 +1010,7 @@ do_node_rejoin(void)
{ {
int ret; int ret;
// XXX we can probably make this an internal function _do_node_archive_config();
do_node_archive_config();
/* execute pg_rewind */ /* execute pg_rewind */
initPQExpBuffer(&command); initPQExpBuffer(&command);
@@ -1048,7 +1049,7 @@ do_node_rejoin(void)
exit(ERR_BAD_CONFIG); exit(ERR_BAD_CONFIG);
} }
/* Restore any previously archived config files */ /* Restore any previously archived config files */
do_node_restore_config(); _do_node_restore_config();
/* remove any recovery.done file copied in by pg_rewind */ /* remove any recovery.done file copied in by pg_rewind */
snprintf(filebuf, MAXPGPATH, snprintf(filebuf, MAXPGPATH,
@@ -1080,8 +1081,8 @@ do_node_rejoin(void)
* *
* Requires configuration file, optionally --config_archive_dir * Requires configuration file, optionally --config_archive_dir
*/ */
void static void
do_node_archive_config(void) _do_node_archive_config(void)
{ {
char archive_dir[MAXPGPATH]; char archive_dir[MAXPGPATH];
struct stat statbuf; struct stat statbuf;
@@ -1261,8 +1262,8 @@ do_node_archive_config(void)
* Removes --config_archive_dir after successful copy * Removes --config_archive_dir after successful copy
*/ */
void static void
do_node_restore_config(void) _do_node_restore_config(void)
{ {
char archive_dir[MAXPGPATH]; char archive_dir[MAXPGPATH];

View File

@@ -12,8 +12,6 @@ extern CheckStatus do_node_check_archiver(PGconn *conn, OutputMode mode, PQExpBu
extern CheckStatus do_node_check_replication_lag(PGconn *conn, OutputMode mode, PQExpBufferData *output); extern CheckStatus do_node_check_replication_lag(PGconn *conn, OutputMode mode, PQExpBufferData *output);
extern void do_node_rejoin(void); extern void do_node_rejoin(void);
extern void do_node_archive_config(void);
extern void do_node_restore_config(void);
extern void do_node_service(void); extern void do_node_service(void);

View File

@@ -31,8 +31,6 @@
* *
* For internal use: * For internal use:
* NODE REJOIN * NODE REJOIN
* NODE ARCHIVE-CONFIG
* NODE RESTORE-CONFIG
* NODE SERVICE * NODE SERVICE
*/ */
@@ -727,10 +725,6 @@ main(int argc, char **argv)
action = NODE_STATUS; action = NODE_STATUS;
else if (strcasecmp(repmgr_action, "REJOIN") == 0) else if (strcasecmp(repmgr_action, "REJOIN") == 0)
action = NODE_REJOIN; action = NODE_REJOIN;
else if (strcasecmp(repmgr_action, "ARCHIVE-CONFIG") == 0)
action = NODE_ARCHIVE_CONFIG;
else if (strcasecmp(repmgr_action, "RESTORE-CONFIG") == 0)
action = NODE_RESTORE_CONFIG;
else if (strcasecmp(repmgr_action, "SERVICE") == 0) else if (strcasecmp(repmgr_action, "SERVICE") == 0)
action = NODE_SERVICE; action = NODE_SERVICE;
} }
@@ -1058,12 +1052,6 @@ main(int argc, char **argv)
case NODE_REJOIN: case NODE_REJOIN:
do_node_rejoin(); do_node_rejoin();
break; break;
case NODE_ARCHIVE_CONFIG:
do_node_archive_config();
break;
case NODE_RESTORE_CONFIG:
do_node_restore_config();
break;
case NODE_SERVICE: case NODE_SERVICE:
do_node_service(); do_node_service();
break; break;
@@ -1505,10 +1493,6 @@ action_name(const int action)
return "NODE CHECK"; return "NODE CHECK";
case NODE_REJOIN: case NODE_REJOIN:
return "NODE REJOIN"; return "NODE REJOIN";
case NODE_ARCHIVE_CONFIG:
return "NODE ARCHIVE-CONFIG";
case NODE_RESTORE_CONFIG:
return "NODE RESTORE-CONFIG";
case NODE_SERVICE: case NODE_SERVICE:
return "NODE SERVICE"; return "NODE SERVICE";

View File

@@ -26,13 +26,11 @@
#define NODE_CHECK 12 #define NODE_CHECK 12
#define NODE_SERVICE 13 #define NODE_SERVICE 13
#define NODE_REJOIN 14 #define NODE_REJOIN 14
#define NODE_ARCHIVE_CONFIG 15 #define CLUSTER_SHOW 15
#define NODE_RESTORE_CONFIG 16 #define CLUSTER_CLEANUP 16
#define CLUSTER_SHOW 17 #define CLUSTER_MATRIX 17
#define CLUSTER_CLEANUP 18 #define CLUSTER_CROSSCHECK 18
#define CLUSTER_MATRIX 19 #define CLUSTER_EVENT 19
#define CLUSTER_CROSSCHECK 20
#define CLUSTER_EVENT 21
/* command line options without short versions */ /* command line options without short versions */
#define OPT_HELP 1001 #define OPT_HELP 1001