From ecf1887e5b197338c3a628385cbe24c615cca4cc Mon Sep 17 00:00:00 2001 From: Bryan Boreham Date: Mon, 11 Apr 2016 11:42:08 +0100 Subject: [PATCH] Initialize Paxos quorum to 0 until this node needs to request consensus. With a 0 quorum we will participate in voting, but will not actively try to form a ring. --- ipam/allocator.go | 2 +- ipam/paxos/paxos.go | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/ipam/allocator.go b/ipam/allocator.go index 20c78bd5..85b79f35 100644 --- a/ipam/allocator.go +++ b/ipam/allocator.go @@ -86,7 +86,7 @@ func NewAllocator(config Config) *Allocator { if config.IsObserver { participant = paxos.NewObserver() } else { - participant = paxos.NewNode(config.OurName, config.OurUID, 1) + participant = paxos.NewNode(config.OurName, config.OurUID, 0) } return &Allocator{ ourName: config.OurName, diff --git a/ipam/paxos/paxos.go b/ipam/paxos/paxos.go index fe10775b..4a2a53c1 100644 --- a/ipam/paxos/paxos.go +++ b/ipam/paxos/paxos.go @@ -241,6 +241,9 @@ func (node *Node) pickValue() Value { // Has a consensus been reached, based on the known claims of other nodes? func (node *Node) Consensus() (bool, AcceptedValue) { + if node.quorum == 0 { + return false, AcceptedValue{} + } counts := map[ProposalID]uint{} for _, claims := range node.knows {