ctdb-recoverd: Have recovery daemon remember election result
authorMartin Schwenke <martin@meltin.net>
Fri, 23 Oct 2015 03:32:41 +0000 (14:32 +1100)
committerAmitay Isaacs <amitay@samba.org>
Mon, 16 Nov 2015 07:42:11 +0000 (08:42 +0100)
The recovery daemon pushes knowledge of recovery master election
progress/result to local daemon.  It then retrieves that information
again.

Instead, have the recovery daemon reliably track election
progress/result in rec->recmaster so it doesn't need to be retrieved.
Be careful to maintain consistency by only doing this when the local
daemon has been updated.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
ctdb/server/ctdb_recoverd.c

index abc5d0f1e4f6854145bb8af22db5c86b6e4b358c..6e3e64eb8cdd876fe9f405147f270f194d5a2f1e 100644 (file)
@@ -2382,7 +2382,7 @@ static int send_election_request(struct ctdb_recoverd *rec, uint32_t pnn)
                DEBUG(DEBUG_ERR, (__location__ " failed to send recmaster election request\n"));
                return -1;
        }
-
+       rec->recmaster = pnn;
 
        /* send an election message to all active nodes */
        DEBUG(DEBUG_INFO,(__location__ " Send election request to all active nodes\n"));
@@ -2791,6 +2791,7 @@ static void election_handler(uint64_t srvid, TDB_DATA data, void *private_data)
                DEBUG(DEBUG_ERR, (__location__ " failed to send recmaster election request"));
                return;
        }
+       rec->recmaster = em->pnn;
 
        return;
 }