From bae82318f1a484d44e24fc59a732d14a04b36724 Mon Sep 17 00:00:00 2001 From: Ian Barwick Date: Wed, 9 Aug 2017 13:32:15 +0900 Subject: [PATCH] No need to expose configuration file archive functions as repmgr commands --- repmgr-action-node.c | 15 ++++++++------- repmgr-action-node.h | 2 -- repmgr-client.c | 16 ---------------- repmgr-client.h | 12 +++++------- 4 files changed, 13 insertions(+), 32 deletions(-) diff --git a/repmgr-action-node.c b/repmgr-action-node.c index b0cf4679..1fab24cc 100644 --- a/repmgr-action-node.c +++ b/repmgr-action-node.c @@ -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_list_actions(t_server_action action); static void _do_node_status_is_shutdown(void); +static void _do_node_archive_config(void); +static void _do_node_restore_config(void); void do_node_status(void) @@ -1008,8 +1010,7 @@ do_node_rejoin(void) { int ret; - // XXX we can probably make this an internal function - do_node_archive_config(); + _do_node_archive_config(); /* execute pg_rewind */ initPQExpBuffer(&command); @@ -1048,7 +1049,7 @@ do_node_rejoin(void) exit(ERR_BAD_CONFIG); } /* Restore any previously archived config files */ - do_node_restore_config(); + _do_node_restore_config(); /* remove any recovery.done file copied in by pg_rewind */ snprintf(filebuf, MAXPGPATH, @@ -1080,8 +1081,8 @@ do_node_rejoin(void) * * Requires configuration file, optionally --config_archive_dir */ -void -do_node_archive_config(void) +static void +_do_node_archive_config(void) { char archive_dir[MAXPGPATH]; struct stat statbuf; @@ -1261,8 +1262,8 @@ do_node_archive_config(void) * Removes --config_archive_dir after successful copy */ -void -do_node_restore_config(void) +static void +_do_node_restore_config(void) { char archive_dir[MAXPGPATH]; diff --git a/repmgr-action-node.h b/repmgr-action-node.h index 810a4de8..15e5d485 100644 --- a/repmgr-action-node.h +++ b/repmgr-action-node.h @@ -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 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); diff --git a/repmgr-client.c b/repmgr-client.c index 5f42fe7e..94c886be 100644 --- a/repmgr-client.c +++ b/repmgr-client.c @@ -31,8 +31,6 @@ * * For internal use: * NODE REJOIN - * NODE ARCHIVE-CONFIG - * NODE RESTORE-CONFIG * NODE SERVICE */ @@ -727,10 +725,6 @@ main(int argc, char **argv) action = NODE_STATUS; else if (strcasecmp(repmgr_action, "REJOIN") == 0) 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) action = NODE_SERVICE; } @@ -1058,12 +1052,6 @@ main(int argc, char **argv) case NODE_REJOIN: do_node_rejoin(); break; - case NODE_ARCHIVE_CONFIG: - do_node_archive_config(); - break; - case NODE_RESTORE_CONFIG: - do_node_restore_config(); - break; case NODE_SERVICE: do_node_service(); break; @@ -1505,10 +1493,6 @@ action_name(const int action) return "NODE CHECK"; case NODE_REJOIN: return "NODE REJOIN"; - case NODE_ARCHIVE_CONFIG: - return "NODE ARCHIVE-CONFIG"; - case NODE_RESTORE_CONFIG: - return "NODE RESTORE-CONFIG"; case NODE_SERVICE: return "NODE SERVICE"; diff --git a/repmgr-client.h b/repmgr-client.h index 220ffbd2..63e87a39 100644 --- a/repmgr-client.h +++ b/repmgr-client.h @@ -26,13 +26,11 @@ #define NODE_CHECK 12 #define NODE_SERVICE 13 #define NODE_REJOIN 14 -#define NODE_ARCHIVE_CONFIG 15 -#define NODE_RESTORE_CONFIG 16 -#define CLUSTER_SHOW 17 -#define CLUSTER_CLEANUP 18 -#define CLUSTER_MATRIX 19 -#define CLUSTER_CROSSCHECK 20 -#define CLUSTER_EVENT 21 +#define CLUSTER_SHOW 15 +#define CLUSTER_CLEANUP 16 +#define CLUSTER_MATRIX 17 +#define CLUSTER_CROSSCHECK 18 +#define CLUSTER_EVENT 19 /* command line options without short versions */ #define OPT_HELP 1001