Skip to content

Commit

Permalink
Initialize Paxos quorum to 0 until this node needs to request consensus.
Browse files Browse the repository at this point in the history
With a 0 quorum we will participate in voting, but will not actively
try to form a ring.
  • Loading branch information
bboreham committed Apr 11, 2016
1 parent 16e5032 commit ecf1887
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 1 addition & 1 deletion ipam/allocator.go
Expand Up @@ -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,
Expand Down
3 changes: 3 additions & 0 deletions ipam/paxos/paxos.go
Expand Up @@ -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 {
Expand Down

0 comments on commit ecf1887

Please sign in to comment.