struct election_message *em = (struct election_message *)data.dptr;
TALLOC_CTX *mem_ctx;
- mem_ctx = talloc_new(ctdb);
-
if (em->vnn==ctdb_get_vnn(ctdb)) {
- talloc_free(mem_ctx);
return;
}
+
+ mem_ctx = talloc_new(ctdb);
/* someone called an election. check their election data
and if we disagree and we would rather be the elected node,
goto again;
}
-
/* verify that the recmaster node is still active */
for (j=0; j<nodemap->num; j++) {
if (nodemap->nodes[j].vnn==recmaster) {
break;
}
- }
+ }
if (!(nodemap->nodes[j].flags&NODE_FLAGS_CONNECTED)) {
DEBUG(0, ("Recmaster node %u no longer available. Force reelection\n", nodemap->nodes[j].vnn));
force_election(ctdb, mem_ctx, vnn, nodemap);
/* there better be the same number of lmasters in the vnn map
- as there are active nodes or well have to do a recovery
+ as there are active nodes or we will have to do a recovery
*/
if (vnnmap->size != num_active) {
DEBUG(0, (__location__ "The vnnmap count is different from the number of active nodes. %d vs %d\n", vnnmap->size, num_active));
}
#endif
+ srandom(getpid() ^ time(NULL));
+
ev = event_context_init(NULL);
/* initialise ctdb */