tikv

package
v5.3.0+incompatible Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckPDVersion

func CheckPDVersion(ctx context.Context, tls *common.TLS, pdAddr string, requiredMinVersion, requiredMaxVersion semver.Version) error

func CheckTiKVVersion

func CheckTiKVVersion(ctx context.Context, tls *common.TLS, pdAddr string, requiredMinVersion, requiredMaxVersion semver.Version) error

func Compact

func Compact(ctx context.Context, tls *common.TLS, tikvAddr string, level int32) error

Compact performs a leveled compaction with the given minimum level.

func FetchMode

func FetchMode(ctx context.Context, tls *common.TLS, tikvAddr string) (import_sstpb.SwitchMode, error)

FetchMode obtains the import mode status of the TiKV node.

func FetchModeFromMetrics

func FetchModeFromMetrics(metrics string) (import_sstpb.SwitchMode, error)

FetchMode obtains the import mode status from the Prometheus metrics of a TiKV node.

func FetchRemoteTableModelsFromTLS

func FetchRemoteTableModelsFromTLS(ctx context.Context, tls *common.TLS, schema string) ([]*model.TableInfo, error)

func ForAllStores

func ForAllStores(
	ctx context.Context,
	tls *common.TLS,
	minState StoreState,
	action func(c context.Context, store *Store) error,
) error

ForAllStores executes `action` in parallel for all TiKV stores connected to a PD server given by the HTTPS client `tls`.

Returns the first non-nil error returned in all `action` calls. If all `action` returns nil, this method would return nil as well.

The `minState` argument defines the minimum store state to be included in the result (Tombstone < Offline < Down < Disconnected < Up).

func SwitchMode

func SwitchMode(ctx context.Context, tls *common.TLS, tikvAddr string, mode import_sstpb.SwitchMode) error

SwitchMode changes the TiKV node at the given address to a particular mode.

Types

type Store

type Store struct {
	Address string
	Version string
	State   StoreState `json:"state_name"`
}

Store contains metadata about a TiKV store.

type StoreState

type StoreState int

StoreState is the state of a TiKV store. The numerical value is sorted by the store's accessibility (Tombstone < Down < Disconnected < Offline < Up).

The meaning of each state can be found from PingCAP's documentation at https://pingcap.com/docs/v3.0/how-to/scale/horizontally/#delete-a-node-dynamically-1

const (
	// StoreStateUp means the TiKV store is in service.
	StoreStateUp StoreState = -iota
	// StoreStateOffline means the TiKV store is in the process of being taken
	// offline (but is still accessible).
	StoreStateOffline
	// StoreStateDisconnected means the TiKV store does not respond to PD.
	StoreStateDisconnected
	// StoreStateDown means the TiKV store does not respond to PD for a long
	// time (> 30 minutes).
	StoreStateDown
	// StoreStateTombstone means the TiKV store is shut down and the data has
	// been evacuated. Lightning should never interact with stores in this
	// state.
	StoreStateTombstone
)

func (*StoreState) UnmarshalJSON

func (ss *StoreState) UnmarshalJSON(content []byte) error

UnmarshalJSON implements the json.Unmarshaler interface.

Jump to

Keyboard shortcuts

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