merge from ronnie
authorAndrew Tridgell <tridge@samba.org>
Mon, 15 Oct 2007 04:17:49 +0000 (14:17 +1000)
committerAndrew Tridgell <tridge@samba.org>
Mon, 15 Oct 2007 04:17:49 +0000 (14:17 +1000)
1  2 
include/ctdb_private.h
packaging/RPM/ctdb.spec
server/ctdb_recoverd.c

Simple merge
Simple merge
index bfc9c167a215522f372d0e8bf4519d081fc986c3,7b574cf3ab772100779de2e896779524556b284b..5ead441eb097fe8f6cffaaa0c6ab122952f49f0e
@@@ -1022,26 -1017,14 +1022,14 @@@ static bool ctdb_election_win(struct ct
  
        ctdb_election_data(rec, &myem);
  
-       /* try to use a unbanned node */
-       if ((em->node_flags & NODE_FLAGS_BANNED) &&
-           !(myem.node_flags & NODE_FLAGS_BANNED)) {
-               cmp = 1;
-       }
-       if (!(em->node_flags & NODE_FLAGS_BANNED) &&
-           (myem.node_flags & NODE_FLAGS_BANNED)) {
-               cmp = -1;
-       }
+       /* we cant win if we are banned */
+       if (rec->node_flags & NODE_FLAGS_BANNED) {
 -              return 0;
++              return false;
+       }       
  
-       /* try to use a healthy node */
-       if (cmp == 0) {
-               if ((em->node_flags & NODE_FLAGS_UNHEALTHY) &&
-                   !(myem.node_flags & NODE_FLAGS_UNHEALTHY)) {
-                       cmp = 1;
-               }
-               if (!(em->node_flags & NODE_FLAGS_UNHEALTHY) &&
-                   (myem.node_flags & NODE_FLAGS_UNHEALTHY)) {
-                       cmp = -1;
-               }
+       /* we will automatically win if the other node is banned */
+       if (em->node_flags & NODE_FLAGS_BANNED) {
 -              return 1;
++              return true;
        }
  
        /* try to use the most connected node */
@@@ -1585,7 -1568,24 +1573,24 @@@ again
                goto again;
        }
  
-       if (nodemap->nodes[j].flags & NODE_FLAGS_INACTIVE) {
+       /* if recovery master is disconnected we must elect a new recmaster */
+       if (nodemap->nodes[j].flags & NODE_FLAGS_DISCONNECTED) {
+               DEBUG(0, ("Recmaster node %u is disconnected. Force reelection\n", nodemap->nodes[j].pnn));
+               force_election(rec, mem_ctx, pnn, nodemap);
+               goto again;
+       }
 -      /* grap the nodemap from the recovery master to check if it is banned*/
++      /* grap the nodemap from the recovery master to check if it is banned */
+       ret = ctdb_ctrl_getnodemap(ctdb, CONTROL_TIMEOUT(), nodemap->nodes[j].pnn, 
+                                  mem_ctx, &remote_nodemap);
+       if (ret != 0) {
+               DEBUG(0, (__location__ " Unable to get nodemap from recovery master %u\n", 
+                         nodemap->nodes[j].pnn));
+               goto again;
+       }
+       if (remote_nodemap->nodes[j].flags & NODE_FLAGS_INACTIVE) {
                DEBUG(0, ("Recmaster node %u no longer available. Force reelection\n", nodemap->nodes[j].pnn));
                force_election(rec, mem_ctx, pnn, nodemap);
                goto again;