From 606d0afabc53ec92c2a0091c8373905f0db8c041 Mon Sep 17 00:00:00 2001 From: Ian Barwick Date: Mon, 9 Mar 2015 15:48:46 +0900 Subject: [PATCH] primary -> master For consistency. --- dbutils.c | 12 ++++++------ repmgr.c | 27 ++------------------------- repmgrd.c | 12 ++++++------ 3 files changed, 14 insertions(+), 37 deletions(-) diff --git a/dbutils.c b/dbutils.c index b01b45ea..a46f169a 100644 --- a/dbutils.c +++ b/dbutils.c @@ -210,11 +210,11 @@ get_primary_node_id(PGconn *conn, char *cluster) int retval; sqlquery_snprintf(sqlquery, - "SELECT id " - " FROM %s.repl_nodes " - " WHERE cluster = '%s' " - " AND type = 'primary' " - " AND active IS TRUE ", + "SELECT id " + " FROM %s.repl_nodes " + " WHERE cluster = '%s' " + " AND type = 'master' " + " AND active IS TRUE ", get_repmgr_schema_quoted(conn), cluster); @@ -440,7 +440,7 @@ get_primary_connection(PGconn *standby_conn, char *cluster, " SELECT n.conninfo, n.name, n.id " " FROM %s.repl_nodes n " " WHERE n.cluster = '%s' " - " AND n.type = 'primary' ", + " AND n.type = 'master' ", get_repmgr_schema_quoted(standby_conn), cluster); diff --git a/repmgr.c b/repmgr.c index cd5907a7..016c1721 100644 --- a/repmgr.c +++ b/repmgr.c @@ -760,7 +760,7 @@ do_master_register(void) record_created = create_node_record(conn, "master register", options.node, - "primary", + "master", NO_UPSTREAM_NODE, options.cluster_name, options.node_name, @@ -2461,7 +2461,7 @@ create_schema(PGconn *conn) sqlquery_snprintf(sqlquery, "CREATE TABLE %s.repl_nodes ( " " id INTEGER PRIMARY KEY, " - " type TEXT NOT NULL CHECK (type IN('primary','standby','witness')), " + " type TEXT NOT NULL CHECK (type IN('master','standby','witness')), " " upstream_node_id INTEGER NULL REFERENCES %s.repl_nodes (id), " " cluster TEXT NOT NULL, " " name TEXT NOT NULL, " @@ -2556,29 +2556,6 @@ create_schema(PGconn *conn) } PQclear(res); - /* repl_events */ - sqlquery_snprintf(sqlquery, - "CREATE TABLE %s.repl_events ( " - " node_id INTEGER NOT NULL, " - " event TEXT NOT NULL, " - " successful BOOLEAN NOT NULL DEFAULT TRUE, " - " event_timestamp TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT CURRENT_TIMESTAMP, " - " details TEXT NULL " - " ) ", - get_repmgr_schema_quoted(conn)); - - log_debug(_("master register: %s\n"), sqlquery); - res = PQexec(conn, sqlquery); - if (!res || PQresultStatus(res) != PGRES_COMMAND_OK) - { - log_err(_("unable to create table '%s.repl_events': %s\n"), - get_repmgr_schema_quoted(conn), PQerrorMessage(conn)); - PQfinish(conn); - exit(ERR_BAD_CONFIG); - } - PQclear(res); - - /* * XXX Here we MUST try to load the repmgr_function.sql not hardcode it * here diff --git a/repmgrd.c b/repmgrd.c index 71e8bd28..29a6a49c 100644 --- a/repmgrd.c +++ b/repmgrd.c @@ -814,7 +814,7 @@ standby_monitor(void) sprintf(sqlquery, "SELECT id " " FROM %s.repl_nodes " - " WHERE type = 'primary' " + " WHERE type = 'master' " " AND active IS TRUE ", get_repmgr_schema_quoted(my_local_conn)); @@ -1492,9 +1492,9 @@ do_upstream_standby_failover(t_node_info upstream_node) * provide an option to either try and find the current primary and/or * a strategy to connect to a different upstream node */ - if(strcmp(PQgetvalue(res, 0, 4), "primary") == 0) + if(strcmp(PQgetvalue(res, 0, 4), "master") == 0) { - log_err(_("unable to find active upstream node\n")); + log_err(_("unable to find active master node\n")); PQclear(res); return false; } @@ -1613,7 +1613,7 @@ set_local_node_failed(void) sqlquery_snprintf(sqlquery, "SELECT id, conninfo " " FROM %s.repl_nodes " - " WHERE type = 'primary' " + " WHERE type = 'master' " " AND active IS TRUE ", get_repmgr_schema_quoted(primary_conn)); @@ -2110,7 +2110,7 @@ get_node_info(PGconn *conn, char *cluster, int node_id) static t_server_type parse_node_type(const char *type) { - if(strcmp(type, "primary") == 0) + if(strcmp(type, "master") == 0) { return PRIMARY; } @@ -2174,7 +2174,7 @@ update_node_record_set_primary(PGconn *conn, int this_node_id, int old_primary_n sqlquery_snprintf(sqlquery, " UPDATE %s.repl_nodes " - " SET type = 'primary', " + " SET type = 'master', " " upstream_node_id = NULL " " WHERE cluster = '%s' " " AND id = %i ",