tikv

package
v1.1.0-beta.0...-0ffac36 Latest Latest
Warning

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

Go to latest
Published: Dec 9, 2024 License: Apache-2.0 Imports: 35 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckPDVersion

func CheckPDVersion(
	ctx context.Context,
	pdHTTPCli pdhttp.Client,
	requiredMinVersion, requiredMaxVersion semver.Version,
) error

CheckPDVersion checks the version of PD.

func CheckTiKVVersion

func CheckTiKVVersion(
	ctx context.Context,
	pdHTTPCli pdhttp.Client,
	requiredMinVersion, requiredMaxVersion semver.Version,
) error

CheckTiKVVersion checks the version of TiKV.

func Compact

func Compact(ctx context.Context, tls *common.TLS, tikvAddr string, level int32, resourceGroupName string) 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)

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

func FetchRemoteDBModelsFromTLS

func FetchRemoteDBModelsFromTLS(ctx context.Context, tls *common.TLS) ([]*model.DBInfo, error)

FetchRemoteDBModelsFromTLS obtains the remote DB models from the given TLS.

func FetchRemoteTableModelsFromTLS

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

FetchRemoteTableModelsFromTLS obtains the remote table models from the given TLS.

func ForAllStores

func ForAllStores(
	ctx context.Context,
	pdHTTPCli pdhttp.Client,
	maxState metapb.StoreState,
	action func(c context.Context, store *pdhttp.MetaStore) error,
) error

ForAllStores executes `action` in parallel for all TiKV stores connected to a PD server.

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

The `maxState` argument defines the maximum store state (inclusive) to be included in the result (Up < Offline < Tombstone).

func ForTiKVVersions

func ForTiKVVersions(
	ctx context.Context,
	pdHTTPCli pdhttp.Client,
	action func(ver *semver.Version, addrMsg string) error,
) error

ForTiKVVersions runs the given action for all versions of TiKV nodes.

func SwitchMode

func SwitchMode(
	ctx context.Context,
	tls *tls.Config,
	tikvAddr string,
	mode import_sstpb.SwitchMode,
	ranges ...*import_sstpb.Range,
) error

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

Types

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
)

Jump to

Keyboard shortcuts

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