confchange

package
v0.0.0-...-d88c8b5 Latest Latest
Warning

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

Go to latest
Published: Feb 9, 2021 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Describe

func Describe(ccs ...pb.ConfChangeSingle) string

Describe prints the type and NodeID of the configuration changes as a space-delimited string.

func Restore

Restore takes a Changer (which must represent an empty configuration), and runs a sequence of changes enacting the configuration described in the ConfState.

TODO(tbg) it's silly that this takes a Changer. Unravel this by making sure the Changer only needs a ProgressMap (not a whole Tracker) at which point this can just take LastIndex and MaxInflight directly instead and cook up the results from that alone.

Types

type Changer

type Changer struct {
	Tracker   tracker.ProgressTracker
	LastIndex uint64
}

Changer facilitates configuration changes. It exposes methods to handle simple and joint consensus while performing the proper validation that allows refusing invalid configuration changes before they affect the active configuration.

func (Changer) EnterJoint

func (c Changer) EnterJoint(autoLeave bool, ccs ...pb.ConfChangeSingle) (tracker.Config, tracker.ProgressMap, error)

EnterJoint verifies that the outgoing (=right) majority config of the joint config is empty and initializes it with a copy of the incoming (=left) majority config. That is, it transitions from

(1 2 3)&&()

to

(1 2 3)&&(1 2 3).

The supplied changes are then applied to the incoming majority config, resulting in a joint configuration that in terms of the Raft thesis1 (Section 4.3) corresponds to `C_{new,old}`.

func (Changer) LeaveJoint

func (c Changer) LeaveJoint() (tracker.Config, tracker.ProgressMap, error)

LeaveJoint transitions out of a joint configuration. It is an error to call this method if the configuration is not joint, i.e. if the outgoing majority config Voters1 is empty.

The outgoing majority config of the joint configuration will be removed, that is, the incoming config is promoted as the sole decision maker. In the notation of the Raft thesis1 (Section 4.3), this method transitions from `C_{new,old}` into `C_new`.

At the same time, any staged learners (LearnersNext) the addition of which was held back by an overlapping voter in the former outgoing config will be inserted into Learners.

func (Changer) Simple

Simple carries out a series of configuration changes that (in aggregate) mutates the incoming majority config Voters[0] by at most one. This method will return an error if that is not the case, if the resulting quorum is zero, or if the configuration is in a joint state (i.e. if there is an outgoing configuration).

Jump to

Keyboard shortcuts

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