etcd: Index | Files

package confchange

import ""


Package Files

confchange.go restore.go

func Describe Uses

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

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

func Restore Uses

func Restore(chg Changer, cs pb.ConfState) (tracker.Config, tracker.ProgressMap, error)

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.

type Changer Uses

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 Uses

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)&&()


(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 thesis[1] (Section 4.3) corresponds to `C_{new,old}`.


func (Changer) LeaveJoint Uses

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 Voters[1] 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 thesis[1] (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 Uses

func (c Changer) Simple(ccs ...pb.ConfChangeSingle) (tracker.Config, tracker.ProgressMap, error)

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).

Package confchange imports 6 packages (graph). Updated 2020-05-05. Refresh now. Tools for package owners.