join

package
v4.0.1 Latest Latest
Warning

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

Go to latest
Published: Jun 5, 2020 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func PrepareJoinCluster

func PrepareJoinCluster(cfg *config.Config) error

PrepareJoinCluster sends MemberAdd command to PD cluster, and returns the initial configuration of the PD cluster.

TL;TR: The join functionality is safe. With data, join does nothing, w/o data

and it is not a member of cluster, join does MemberAdd, it returns an
error if PD tries to join itself, missing data or join a duplicated PD.

Etcd automatically re-joins the cluster if there is a data directory. So first it checks if there is a data directory or not. If there is, it returns an empty string (etcd will get the correct configurations from the data directory.)

If there is no data directory, there are following cases:

  • A new PD joins an existing cluster. What join does: MemberAdd, MemberList, then generate initial-cluster.

  • A failed PD re-joins the previous cluster. What join does: return an error. (etcd reports: raft log corrupted, truncated, or lost?)

  • A deleted PD joins to previous cluster. What join does: MemberAdd, MemberList, then generate initial-cluster. (it is not in the member list and there is no data, so we can treat it as a new PD.)

If there is a data directory, there are following special cases:

  • A failed PD tries to join the previous cluster but it has been deleted during its downtime. What join does: return "" (etcd will connect to other peers and find that the PD itself has been removed.)

  • A deleted PD joins the previous cluster. What join does: return "" (as etcd will read data directory and find that the PD itself has been removed, so an empty string is fine.)

Types

This section is empty.

Jump to

Keyboard shortcuts

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