clear cluster_master on election so that slaves will accept a new master release_2_0_23
authorbodea <bodea>
Sun, 3 Jul 2005 02:58:06 +0000 (02:58 +0000)
committerbodea <bodea>
Sun, 3 Jul 2005 02:58:06 +0000 (02:58 +0000)
Changes
cluster.c

diff --git a/Changes b/Changes
index ac8c547..0df180a 100644 (file)
--- a/Changes
+++ b/Changes
@@ -1,5 +1,6 @@
 * Sun Jul 3 2005 Brendan O'Dea <bod@optus.net> 2.0.23
 - Backout regular_cleanup changes.
+- Clear cluster_master on election so that slaves will accept a new master.
 
 * Tue May 31 2005 Brendan O'Dea <bod@optusnet.com.au> 2.0.22
 - Show session open time in "show session"/"show user" detailed output.
index 645403c..8f9c01e 100644 (file)
--- a/cluster.c
+++ b/cluster.c
@@ -1,6 +1,6 @@
 // L2TPNS Clustering Stuff
 
-char const *cvs_id_cluster = "$Id: cluster.c,v 1.26.2.11 2005/05/30 02:55:40 bodea Exp $";
+char const *cvs_id_cluster = "$Id: cluster.c,v 1.26.2.12 2005/07/03 02:58:06 bodea Exp $";
 
 #include <stdio.h>
 #include <stdlib.h>
@@ -523,6 +523,7 @@ void cluster_check_master(void)
                return; // Everything's ok!
 
        config->cluster_last_hb = TIME + 1;     // Just the one election thanks.
+       config->cluster_master_address = 0;
 
        LOG(0, 0, 0, "Master timed out! Holding election...\n");
 
@@ -558,7 +559,6 @@ void cluster_check_master(void)
                // to become a master!!!
 
        config->cluster_iam_master = 1;
-       config->cluster_master_address = 0;
 
        LOG(0, 0, 0, "I am declaring myself the master!\n");
 
@@ -1243,8 +1243,7 @@ static int cluster_process_heartbeat(uint8_t *data, int size, int more, uint8_t
                // Note that after a clean failover, the cluster_master_address
                // is cleared, so this doesn't run. 
                //
-       if (config->cluster_master_address && addr != config->cluster_master_address
-           && (config->cluster_last_hb + config->cluster_hb_timeout - 11) > TIME) {
+       if (config->cluster_master_address && addr != config->cluster_master_address) {
                    LOG(0, 0, 0, "Ignoring stray heartbeat from %s, current master %s has not yet timed out (last heartbeat %.1f seconds ago).\n",
                            fmtaddr(addr, 0), fmtaddr(config->cluster_master_address, 1),
                            0.1 * (TIME - config->cluster_last_hb));