From 5b60be96269132ef07de6dbf20d85095c3837a79 Mon Sep 17 00:00:00 2001 From: Xiang Li Date: Wed, 31 Aug 2016 11:52:46 -0700 Subject: [PATCH] integration: fix live lock in issue3699 Do not restart the killed member immediately. The member will advance its election timeout after restart So it will have a better chance to become the leader again. --- integration/cluster_test.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/integration/cluster_test.go b/integration/cluster_test.go index c3658c4ba..627f72ffd 100644 --- a/integration/cluster_test.go +++ b/integration/cluster_test.go @@ -318,6 +318,10 @@ func TestIssue3699(t *testing.T) { for leaderID != 3 { c.Members[leaderID].Stop(t) <-c.Members[leaderID].s.StopNotify() + // do not restart the killed member immediately. + // the member will advance its election timeout after restart, + // so it will have a better chance to become the leader again. + time.Sleep(time.Duration(electionTicks * int(tickDuration))) c.Members[leaderID].Restart(t) leaderID = c.waitLeader(t, c.Members) }