/*
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;
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;
}
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"));
}
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;