From: Rusty Russell Date: Tue, 22 Jun 2010 13:25:20 +0000 (+0930) Subject: speed startup: with --sloppy-start, cut initial election timeout to 1/2 second. X-Git-Tag: ctdb-1.9.1~4 X-Git-Url: http://git.samba.org/?p=rusty%2Fctdb.git;a=commitdiff_plain;h=8f17731dea4287d4f9b21dc58c1bdf26c8a0e628 speed startup: with --sloppy-start, cut initial election timeout to 1/2 second. Seconds between ctdbd first log message and node healthy: BEFORE: 4.03 AFTER: 2.02 Signed-off-by: Rusty Russell --- diff --git a/server/ctdb_recoverd.c b/server/ctdb_recoverd.c index 46321dd7..82fe62ea 100644 --- a/server/ctdb_recoverd.c +++ b/server/ctdb_recoverd.c @@ -905,6 +905,7 @@ static void ctdb_election_timeout(struct event_context *ev, struct timed_event * { struct ctdb_recoverd *rec = talloc_get_type(p, struct ctdb_recoverd); rec->election_timeout = NULL; + fast_start = false; DEBUG(DEBUG_WARNING,(__location__ " Election timed out\n")); } @@ -2091,6 +2092,8 @@ static void election_handler(struct ctdb_context *ctdb, uint64_t srvid, /* we got an election packet - update the timeout for the election */ talloc_free(rec->election_timeout); rec->election_timeout = event_add_timed(ctdb->ev, ctdb, + fast_start ? + timeval_current_ofs(0, 500000) : timeval_current_ofs(ctdb->tunable.election_timeout, 0), ctdb_election_timeout, rec); @@ -2158,6 +2161,8 @@ static void force_election(struct ctdb_recoverd *rec, uint32_t pnn, talloc_free(rec->election_timeout); rec->election_timeout = event_add_timed(ctdb->ev, ctdb, + fast_start ? + timeval_current_ofs(0, 500000) : timeval_current_ofs(ctdb->tunable.election_timeout, 0), ctdb_election_timeout, rec);