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>
Wed, 30 Oct 2013 00:34:56 +0000 (11:34 +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

server/ctdb_recoverd.c

index e5c2887f44f37a78cc7b88b1ba6be357b7d3dd80..ea37af2feea29736b53d25994c533b31fef0b211 100644 (file)
@@ -2178,7 +2178,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;
@@ -2194,27 +2194,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;
 }
 
@@ -2252,7 +2245,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"));
        }
@@ -2729,7 +2722,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;