Remove witness server references

This commit is contained in:
Ian Barwick
2017-07-10 09:31:31 +09:00
parent 9e3d942917
commit 5fbcf3e476
12 changed files with 12 additions and 74 deletions

View File

@@ -248,12 +248,6 @@ _parse_config(t_configuration_options *options, ItemList *error_list, ItemList *
options->monitoring_history = false; /* new in 4.0, replaces --monitoring-history */ options->monitoring_history = false; /* new in 4.0, replaces --monitoring-history */
options->degraded_monitoring_timeout = -1; options->degraded_monitoring_timeout = -1;
/* witness settings
* ---------------- */
/* default to resyncing repl_nodes table every 30 seconds on the witness server */
options->witness_repl_nodes_sync_interval_secs = 30;
/* service settings /* service settings
* ---------------- */ * ---------------- */
memset(options->pg_ctl_options, 0, sizeof(options->pg_ctl_options)); memset(options->pg_ctl_options, 0, sizeof(options->pg_ctl_options));
@@ -421,10 +415,6 @@ _parse_config(t_configuration_options *options, ItemList *error_list, ItemList *
else if (strcmp(name, "degraded_monitoring_timeout") == 0) else if (strcmp(name, "degraded_monitoring_timeout") == 0)
options->degraded_monitoring_timeout = repmgr_atoi(value, name, error_list, 1); options->degraded_monitoring_timeout = repmgr_atoi(value, name, error_list, 1);
/* witness settings */
else if (strcmp(name, "witness_repl_nodes_sync_interval_secs") == 0)
options->witness_repl_nodes_sync_interval_secs = repmgr_atoi(value, name, error_list, 1);
/* service settings */ /* service settings */
else if (strcmp(name, "pg_ctl_options") == 0) else if (strcmp(name, "pg_ctl_options") == 0)
strncpy(options->pg_ctl_options, value, MAXLEN); strncpy(options->pg_ctl_options, value, MAXLEN);

View File

@@ -85,9 +85,6 @@ typedef struct
bool monitoring_history; bool monitoring_history;
int degraded_monitoring_timeout; int degraded_monitoring_timeout;
/* witness settings */
int witness_repl_nodes_sync_interval_secs;
/* service settings */ /* service settings */
char pg_ctl_options[MAXLEN]; char pg_ctl_options[MAXLEN];
char service_stop_command[MAXLEN]; char service_stop_command[MAXLEN];
@@ -131,8 +128,6 @@ typedef struct
DEFAULT_RECONNECTION_ATTEMPTS, \ DEFAULT_RECONNECTION_ATTEMPTS, \
DEFAULT_RECONNECTION_INTERVAL, \ DEFAULT_RECONNECTION_INTERVAL, \
300, false, -1, \ 300, false, -1, \
/* witness settings */ \
30, \
/* service settings */ \ /* service settings */ \
"", "", "", "", "", "", \ "", "", "", "", "", "", \
/* event notification settings */ \ /* event notification settings */ \

View File

@@ -1226,10 +1226,6 @@ parse_node_type(const char *type)
{ {
return STANDBY; return STANDBY;
} }
else if (strcmp(type, "witness") == 0)
{
return WITNESS;
}
else if (strcmp(type, "bdr") == 0) else if (strcmp(type, "bdr") == 0)
{ {
return BDR; return BDR;
@@ -1247,8 +1243,6 @@ get_node_type_string(t_server_type type)
return "primary"; return "primary";
case STANDBY: case STANDBY:
return "standby"; return "standby";
case WITNESS:
return "witness";
case BDR: case BDR:
return "bdr"; return "bdr";
/* this should never happen */ /* this should never happen */

View File

@@ -18,7 +18,6 @@ typedef enum {
UNKNOWN = 0, UNKNOWN = 0,
PRIMARY, PRIMARY,
STANDBY, STANDBY,
WITNESS,
BDR BDR
} t_server_type; } t_server_type;

View File

@@ -22,8 +22,6 @@
#include "strutil.h" #include "strutil.h"
#include "log.h" #include "log.h"
static bool _create_pg_dir(char *dir, bool force, bool for_witness);
static int unlink_dir_callback(const char *fpath, const struct stat *sb, int typeflag, struct FTW *ftwbuf); static int unlink_dir_callback(const char *fpath, const struct stat *sb, int typeflag, struct FTW *ftwbuf);
@@ -240,19 +238,6 @@ is_pg_dir(char *path)
bool bool
create_pg_dir(char *path, bool force) create_pg_dir(char *path, bool force)
{
return _create_pg_dir(path, force, false);
}
bool
create_witness_pg_dir(char *path, bool force)
{
return _create_pg_dir(path, force, true);
}
static bool
_create_pg_dir(char *path, bool force, bool for_witness)
{ {
bool pg_dir = false; bool pg_dir = false;
@@ -277,7 +262,7 @@ _create_pg_dir(char *path, bool force, bool for_witness)
if (!set_dir_permissions(path)) if (!set_dir_permissions(path))
{ {
log_error(_("unable to change permissions of directory \"%s\": %s"), log_error(_("unable to change permissions of directory \"%s\":\n %s"),
path, strerror(errno)); path, strerror(errno));
return false; return false;
} }
@@ -289,21 +274,11 @@ _create_pg_dir(char *path, bool force, bool for_witness)
pg_dir = is_pg_dir(path); pg_dir = is_pg_dir(path);
if (pg_dir && force) if (pg_dir && force)
{ {
/* TODO: check DB state, if not running overwrite */
/* if (false)
* The witness server does not store any data other than a copy of the
* repmgr metadata, so in --force mode we can simply overwrite the
* directory.
*
* For non-witness servers, we'll leave the data in place, to reduce
* the risk of unintentional data loss
*
* TODO: check DB state, if not running overwrite
*/
if (for_witness)
{ {
log_notice(_("deleting existing data directory \"%s\""), path); log_notice(_("deleting existing data directory \"%s\""), path);
nftw(path, unlink_dir_callback, 64, FTW_DEPTH | FTW_PHYS); nftw(path, unlink_dir_callback, 64, FTW_DEPTH | FTW_PHYS);

View File

@@ -14,6 +14,5 @@ extern int check_dir(char *path);
extern bool create_dir(char *path); extern bool create_dir(char *path);
extern bool is_pg_dir(char *path); extern bool is_pg_dir(char *path);
extern bool create_pg_dir(char *path, bool force); extern bool create_pg_dir(char *path, bool force);
extern bool create_witness_pg_dir(char *path, bool force);
#endif #endif

View File

@@ -6,7 +6,7 @@ CREATE TABLE nodes (
upstream_node_id INTEGER NULL REFERENCES nodes (node_id) DEFERRABLE, upstream_node_id INTEGER NULL REFERENCES nodes (node_id) DEFERRABLE,
active BOOLEAN NOT NULL DEFAULT TRUE, active BOOLEAN NOT NULL DEFAULT TRUE,
node_name TEXT NOT NULL, node_name TEXT NOT NULL,
type TEXT NOT NULL CHECK (type IN('primary','standby','witness','bdr')), type TEXT NOT NULL CHECK (type IN('primary','standby','bdr')),
location TEXT NOT NULL DEFAULT 'default', location TEXT NOT NULL DEFAULT 'default',
priority INT NOT NULL DEFAULT 100, priority INT NOT NULL DEFAULT 100,
conninfo TEXT NOT NULL, conninfo TEXT NOT NULL,

View File

@@ -551,7 +551,6 @@ main(int argc, char **argv)
* *
* { PRIMARY | MASTER } REGISTER | * { PRIMARY | MASTER } REGISTER |
* STANDBY {REGISTER | UNREGISTER | CLONE [node] | PROMOTE | FOLLOW [node] | SWITCHOVER | REWIND} | * STANDBY {REGISTER | UNREGISTER | CLONE [node] | PROMOTE | FOLLOW [node] | SWITCHOVER | REWIND} |
* WITNESS { CREATE | REGISTER | UNREGISTER } |
* BDR { REGISTER | UNREGISTER } | * BDR { REGISTER | UNREGISTER } |
* CLUSTER { CROSSCHECK | MATRIX | SHOW | CLEANUP | EVENT } * CLUSTER { CROSSCHECK | MATRIX | SHOW | CLEANUP | EVENT }
* *
@@ -1046,7 +1045,6 @@ check_cli_parameters(const int action)
{ {
case PRIMARY_UNREGISTER: case PRIMARY_UNREGISTER:
case STANDBY_UNREGISTER: case STANDBY_UNREGISTER:
case WITNESS_UNREGISTER:
case CLUSTER_EVENT: case CLUSTER_EVENT:
break; break;
default: default:
@@ -1062,7 +1060,6 @@ check_cli_parameters(const int action)
switch (action) switch (action)
{ {
case STANDBY_UNREGISTER: case STANDBY_UNREGISTER:
case WITNESS_UNREGISTER:
case CLUSTER_EVENT: case CLUSTER_EVENT:
if (runtime_options.node_id != UNKNOWN_NODE_ID) if (runtime_options.node_id != UNKNOWN_NODE_ID)
{ {
@@ -1178,8 +1175,6 @@ action_name(const int action)
return "STANDBY REGISTER"; return "STANDBY REGISTER";
case STANDBY_UNREGISTER: case STANDBY_UNREGISTER:
return "STANDBY UNREGISTER"; return "STANDBY UNREGISTER";
case WITNESS_UNREGISTER:
return "WITNESS UNREGISTER";
case CLUSTER_EVENT: case CLUSTER_EVENT:
return "CLUSTER EVENT"; return "CLUSTER EVENT";
} }

View File

@@ -22,16 +22,13 @@
#define STANDBY_SWITCHOVER 8 #define STANDBY_SWITCHOVER 8
#define STANDBY_ARCHIVE_CONFIG 9 #define STANDBY_ARCHIVE_CONFIG 9
#define STANDBY_RESTORE_CONFIG 10 #define STANDBY_RESTORE_CONFIG 10
#define WITNESS_CREATE 11 #define CLUSTER_SHOW 11
#define WITNESS_REGISTER 12 #define CLUSTER_CLEANUP 12
#define WITNESS_UNREGISTER 13 #define CLUSTER_MATRIX 13
#define CLUSTER_SHOW 14 #define CLUSTER_CROSSCHECK 14
#define CLUSTER_CLEANUP 15 #define CLUSTER_EVENT 15
#define CLUSTER_MATRIX 16 #define BDR_REGISTER 16
#define CLUSTER_CROSSCHECK 17 #define BDR_UNREGISTER 17
#define CLUSTER_EVENT 18
#define BDR_REGISTER 19
#define BDR_UNREGISTER 20
/* command line options without short versions */ /* command line options without short versions */
#define OPT_HELP 1 #define OPT_HELP 1

View File

@@ -100,7 +100,7 @@
# By default, all notifications will be passed; the notification types # By default, all notifications will be passed; the notification types
# can be filtered to explicitly named ones, e.g.: # can be filtered to explicitly named ones, e.g.:
# #
# event_notifications=master_register,standby_register,witness_create # event_notifications=master_register,standby_register
#event_notification_command='' # An external program or script which #event_notification_command='' # An external program or script which
# can be executed by the user under which # can be executed by the user under which

View File

@@ -52,7 +52,4 @@
#define ERRBUFF_SIZE 512 #define ERRBUFF_SIZE 512
#define WITNESS_DEFAULT_PORT "5499" /* If this value is ever changed, remember
* to update comments and documentation */
#endif /* _REPMGR_H_ */ #endif /* _REPMGR_H_ */

View File

@@ -471,9 +471,6 @@ start_monitoring(void)
case STANDBY: case STANDBY:
monitor_streaming_standby(); monitor_streaming_standby();
break; break;
case WITNESS:
/* not handled */
return;
case BDR: case BDR:
monitor_bdr(); monitor_bdr();
return; return;