Revert "if a new node enters the cluster, that node will already be frozen at start"
authorMartin Schwenke <martin@meltin.net>
Tue, 29 Oct 2013 05:38:42 +0000 (16:38 +1100)
committerMartin Schwenke <martin@meltin.net>
Mon, 4 Nov 2013 04:35:35 +0000 (15:35 +1100)
This is unnecessary due to 03e2e436db5cfd29a56d13f5d2101e42389bfc94.
Furthermore, if a node doesn't force an election but wins it then it
can fail to record that it is the new recovery master.  This can lead
to a reverse split brain where there is no recovery master.

This reverts commit c5035657606283d2e35bea40992505e84ca8e7be.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Pair-programmed-with: Amitay Isaacs <amitay@gmail.com>

Conflicts:
server/ctdb_recoverd.c

(cherry picked from commit c8b542e059a54b8d524bd430cad9d82e5edd864d)

server/ctdb_recoverd.c

index 9f2c71ca639f496859ef481cad02f66d31c399b2..f7cee5881ae23a765aa0c3bd07edff6d7e13a768 100644 (file)
@@ -1962,7 +1962,7 @@ static bool ctdb_election_win(struct ctdb_recoverd *rec, struct election_message
 /*
   send out an election request
  */
-static int send_election_request(struct ctdb_recoverd *rec, uint32_t pnn, bool update_recmaster)
+static int send_election_request(struct ctdb_recoverd *rec, uint32_t pnn)
 {
        int ret;
        TDB_DATA election_data;
@@ -1978,27 +1978,20 @@ static int send_election_request(struct ctdb_recoverd *rec, uint32_t pnn, bool u
        election_data.dptr  = (unsigned char *)&emsg;
 
 
+       /* first we assume we will win the election and set 
+          recoverymaster to be ourself on the current node
+        */
+       ret = ctdb_ctrl_setrecmaster(ctdb, CONTROL_TIMEOUT(), pnn, pnn);
+       if (ret != 0) {
+               DEBUG(DEBUG_ERR, (__location__ " failed to send recmaster election request\n"));
+               return -1;
+       }
+
+
        /* send an election message to all active nodes */
        DEBUG(DEBUG_INFO,(__location__ " Send election request to all active nodes\n"));
        ctdb_client_send_message(ctdb, CTDB_BROADCAST_ALL, srvid, election_data);
 
-
-       /* A new node that is already frozen has entered the cluster.
-          The existing nodes are not frozen and dont need to be frozen
-          until the election has ended and we start the actual recovery
-       */
-       if (update_recmaster == true) {
-               /* first we assume we will win the election and set 
-                  recoverymaster to be ourself on the current node
-                */
-               ret = ctdb_ctrl_setrecmaster(ctdb, CONTROL_TIMEOUT(), pnn, pnn);
-               if (ret != 0) {
-                       DEBUG(DEBUG_ERR, (__location__ " failed to send recmaster election request\n"));
-                       return -1;
-               }
-       }
-
-
        return 0;
 }
 
@@ -2036,7 +2029,7 @@ static void election_send_request(struct event_context *ev, struct timed_event *
        struct ctdb_recoverd *rec = talloc_get_type(p, struct ctdb_recoverd);
        int ret;
 
-       ret = send_election_request(rec, ctdb_get_pnn(rec->ctdb), false);
+       ret = send_election_request(rec, ctdb_get_pnn(rec->ctdb));
        if (ret != 0) {
                DEBUG(DEBUG_ERR,("Failed to send election request!\n"));
        }
@@ -2392,7 +2385,7 @@ static void force_election(struct ctdb_recoverd *rec, uint32_t pnn,
                                                timeval_current_ofs(ctdb->tunable.election_timeout, 0), 
                                                ctdb_election_timeout, rec);
 
-       ret = send_election_request(rec, pnn, true);
+       ret = send_election_request(rec, pnn);
        if (ret!=0) {
                DEBUG(DEBUG_ERR, (__location__ " failed to initiate recmaster election"));
                return;