Documentation ¶
Index ¶
- func CheckPDVersion(ctx context.Context, tls *common.TLS, pdAddr string, ...) error
- func CheckTiKVVersion(ctx context.Context, tls *common.TLS, pdAddr string, ...) error
- func Compact(ctx context.Context, tls *common.TLS, tikvAddr string, level int32, ...) error
- func FetchMode(ctx context.Context, tls *common.TLS, tikvAddr string) (import_sstpb.SwitchMode, error)
- func FetchModeFromMetrics(metrics string) (import_sstpb.SwitchMode, error)
- func FetchRemoteDBModelsFromTLS(ctx context.Context, tls *common.TLS) ([]*model.DBInfo, error)
- func FetchRemoteTableModelsFromTLS(ctx context.Context, tls *common.TLS, schema string) ([]*model.TableInfo, error)
- func ForAllStores(ctx context.Context, tls *common.TLS, minState StoreState, ...) error
- func SwitchMode(ctx context.Context, tls *common.TLS, tikvAddr string, ...) error
- type Store
- type StoreState
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
CheckPDVersion checks the version of PD.
func CheckTiKVVersion ¶
func CheckTiKVVersion(ctx context.Context, tls *common.TLS, pdAddr string, 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 ¶
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, 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, ranges ...*import_sstpb.Range, ) 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.