quorum

package
v1.2.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 28, 2021 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNoAliveFollowers = errors.New("quorum: replica set does not have any alive followers or all of them were excluded from the election")
	ErrNoCandidateFound = errors.New("quorum: no available candidate found")
)

Functions

This section is empty.

Types

type Elector

type Elector interface {
	// ChooseMaster selects new master and returns back its uuid.
	ChooseMaster(set vshard.ReplicaSet) (vshard.InstanceUUID, error)
	// Mode returns the elector type.
	Mode() Mode
}

func New

func New(m Mode, opts Options) Elector

func NewIdleElector added in v1.1.0

func NewIdleElector(opts Options) Elector

NewIdleElector returns a new elector based on the follower's idle value.

This elector chooses the candidate to be a master selecting the follower with a minimum idle value.

func NewSmartElector

func NewSmartElector(opts Options) Elector

NewSmartElector returns a new elector based on rules:

  • compare vshard configuration consistency,
  • compare upstream status,
  • compare LSN behind the master,
  • compare when replica got last heartbeat signal or data from master,
  • user promotion rules based on instance priorities.

type Mode

type Mode string
const (
	ModeIdle  Mode = "idle"
	ModeSmart Mode = "smart"
)

type Options added in v1.1.0

type Options struct {
	ReasonableFollowerLSNLag int64
	ReasonableFollowerIdle   float64
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL