Unverified Commit 50a09fd0 authored by Jay Guo's avatar Jay Guo Committed by Artem Barger
Browse files

[FAB-12709] Enable CheckQuorum



When CheckQuorum is enabled, leader steps down if it cannot reach
the quorum of network, so that clients have a chance to disconnect
and try other nodes.

Change-Id: I901c0e3009f9d354a2b504fe16174432345055b3
Signed-off-by: default avatarJay Guo <guojiannan1101@gmail.com>
parent 5c3e2fce
......@@ -201,6 +201,7 @@ func NewChain(
// PreVote prevents reconnected node from disturbing network.
// See etcd/raft doc for more details.
PreVote: true,
CheckQuorum: true,
DisableProposalForwarding: true, // This prevents blocks from being accidentally proposed by followers
}
......
......@@ -1891,6 +1891,28 @@ var _ = Describe("Chain", func() {
})
})
When("leader is disconnected", func() {
It("proactively steps down to follower", func() {
network.disconnect(1)
By("Ticking leader until it steps down")
Eventually(func() <-chan raft.SoftState {
c1.clock.Increment(interval)
return c1.observe
}, LongEventualTimeout).Should(Receive(Equal(raft.SoftState{Lead: 0, RaftState: raft.StateFollower})))
By("Ensuring it does not accept message due to the cluster being leaderless")
err := c1.Order(env, 0)
Expect(err).To(MatchError("no Raft leader"))
network.elect(2)
network.join(1, true)
err = c1.Order(env, 0)
Expect(err).NotTo(HaveOccurred())
})
})
When("follower is disconnected", func() {
It("should return error when receiving an env", func() {
network.disconnect(2)
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment