version

package
v3.0.0-...-eac99ac Latest Latest
Warning

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

Go to latest
Published: Oct 4, 2022 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Overview

Package version provides functions for getting/saving storage version.

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalidDowngradeTargetVersion = errors.New("etcdserver: invalid downgrade target version")
	ErrDowngradeInProcess            = errors.New("etcdserver: cluster has a downgrade job in progress")
	ErrNoInflightDowngrade           = errors.New("etcdserver: no inflight downgrade job")
)

Functions

func IsValidVersionChange

func IsValidVersionChange(cv *semver.Version, lv *semver.Version) bool

IsValidVersionChange checks the two scenario when version is valid to change: 1. Downgrade: cluster version is 1 minor version higher than local version, cluster version should change. 2. Cluster start: when not all members version are available, cluster version is set to MinVersion(3.0), when all members are at higher version, cluster version is lower than local version, cluster version should change

func MustDetectDowngrade

func MustDetectDowngrade(lg *zap.Logger, sv, cv *semver.Version)

MustDetectDowngrade will detect local server joining cluster that doesn't support it's version.

Types

type DowngradeInfo

type DowngradeInfo struct {
	// TargetVersion is the target downgrade version, if the cluster is not under downgrading,
	// the targetVersion will be an empty string
	TargetVersion string `json:"target-version"`
	// Enabled indicates whether the cluster is enabled to downgrade
	Enabled bool `json:"enabled"`
}

func (*DowngradeInfo) GetTargetVersion

func (d *DowngradeInfo) GetTargetVersion() *semver.Version

type Manager

type Manager struct {
	// contains filtered or unexported fields
}

Manager contains logic to manage etcd cluster version downgrade process.

func NewManager

func NewManager(lg *zap.Logger, s Server) *Manager

NewManager returns a new manager instance

func (*Manager) DowngradeCancel

func (m *Manager) DowngradeCancel(ctx context.Context) error

DowngradeCancel cancels ongoing downgrade process.

func (*Manager) DowngradeEnable

func (m *Manager) DowngradeEnable(ctx context.Context, targetVersion *semver.Version) error

DowngradeEnable initiates etcd cluster version downgrade process.

func (*Manager) DowngradeValidate

func (m *Manager) DowngradeValidate(ctx context.Context, targetVersion *semver.Version) error

DowngradeValidate validates if cluster is downloadable to provided target version and returns error if not.

type Monitor

type Monitor struct {
	// contains filtered or unexported fields
}

Monitor contains logic used by cluster leader to monitor version changes and decide on cluster version or downgrade progress.

func NewMonitor

func NewMonitor(lg *zap.Logger, storage Server) *Monitor

func (*Monitor) CancelDowngradeIfNeeded

func (m *Monitor) CancelDowngradeIfNeeded()

func (*Monitor) UpdateClusterVersionIfNeeded

func (m *Monitor) UpdateClusterVersionIfNeeded()

UpdateClusterVersionIfNeeded updates the cluster version.

func (*Monitor) UpdateStorageVersionIfNeeded

func (m *Monitor) UpdateStorageVersionIfNeeded()

UpdateStorageVersionIfNeeded updates the storage version if it differs from cluster version.

type Server

type Server interface {
	GetClusterVersion() *semver.Version
	GetDowngradeInfo() *DowngradeInfo
	GetMembersVersions() map[string]*version.Versions
	UpdateClusterVersion(string)
	LinearizableReadNotify(ctx context.Context) error
	DowngradeEnable(ctx context.Context, targetVersion *semver.Version) error
	DowngradeCancel(ctx context.Context) error

	GetStorageVersion() *semver.Version
	UpdateStorageVersion(semver.Version) error
}

Server lists EtcdServer methods needed by Monitor

Jump to

Keyboard shortcuts

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