tiflashcompute

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

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

Go to latest
Published: Nov 26, 2024 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// DispatchPolicyRRStr is string value for DispatchPolicyRR.
	DispatchPolicyRRStr = "round_robin"
	// DispatchPolicyConsistentHashStr is string value for DispatchPolicyConsistentHash.
	DispatchPolicyConsistentHashStr = "consistent_hash"
	// DispatchPolicyInvalidStr is string value for DispatchPolicyInvalid.
	DispatchPolicyInvalidStr = "invalid"
)
View Source
const (
	// MockASStr is string value for mock AutoScaler.
	MockASStr = "mock"
	// AWSASStr is string value for aws AutoScaler.
	AWSASStr = "aws"
	// GCPASStr is string value for gcp AutoScaler.
	GCPASStr = "gcp"
	// TestASStr is string value for test AutoScaler.
	TestASStr = "test"
	// InvalidASStr is string value for invalid AutoScaler.
	InvalidASStr = "invalid"
)
View Source
const (
	// MockASType is int value for mock AutoScaler.
	MockASType int = iota
	// AWSASType is int value for aws AutoScaler.
	AWSASType
	// GCPASType is int value for gcp AutoScaler.
	GCPASType
	// TestASType is for local tidb test AutoScaler.
	TestASType
	// InvalidASType is int value for invalid check.
	InvalidASType
)
View Source
const (
	// DefAWSAutoScalerAddr is the default address for AWS AutoScaler.
	DefAWSAutoScalerAddr = "tiflash-autoscale-lb.tiflash-autoscale.svc.cluster.local:8081"
	// DefASStr default AutoScaler.
	DefASStr = AWSASStr
)

Variables

This section is empty.

Functions

func GetDispatchPolicy

func GetDispatchPolicy(p DispatchPolicy) string

GetDispatchPolicy return corresponding policy string.

func GetValidDispatchPolicy

func GetValidDispatchPolicy() []string

GetValidDispatchPolicy return all valid policy string.

func InitGlobalTopoFetcher

func InitGlobalTopoFetcher(typ string, addr string, clusterID string, isFixedPool bool) (err error)

InitGlobalTopoFetcher init globalTopoFetcher if is in disaggregated-tiflash mode. It's not thread-safe.

func IsValidAutoScalerConfig

func IsValidAutoScalerConfig(typ string) bool

IsValidAutoScalerConfig return true if user config of autoscaler type is valid.

Types

type AWSTopoFetcher

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

AWSTopoFetcher will fetch topo from AWSAutoScaler.

func NewAWSAutoScalerFetcher

func NewAWSAutoScalerFetcher(addr string, clusterID string, isFixed bool) *AWSTopoFetcher

NewAWSAutoScalerFetcher create a new AWSTopoFetcher.

func (*AWSTopoFetcher) FetchAndGetTopo

func (f *AWSTopoFetcher) FetchAndGetTopo() (curTopo []string, err error)

FetchAndGetTopo implements TopoFetcher interface.

func (*AWSTopoFetcher) RecoveryAndGetTopo

func (f *AWSTopoFetcher) RecoveryAndGetTopo(recovery RecoveryType, oriCNCnt int) (curTopo []string, err error)

RecoveryAndGetTopo implements TopoFetcher interface.

type DispatchPolicy

type DispatchPolicy int

DispatchPolicy means different policy to dispatching task to tiflash_compute nods.

const (
	// DispatchPolicyRR means dispatching by RoundRobin.
	DispatchPolicyRR DispatchPolicy = iota
	// DispatchPolicyConsistentHash means dispatching by ConsistentHash.
	DispatchPolicyConsistentHash
	// DispatchPolicyInvalid is invalid policy.
	DispatchPolicyInvalid
)

func GetDispatchPolicyByStr

func GetDispatchPolicyByStr(str string) (DispatchPolicy, error)

GetDispatchPolicyByStr return corresponding policy.

type MockTopoFetcher

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

MockTopoFetcher will fetch topo from MockAutoScaler. MockScaler can run in local environment.

func NewMockAutoScalerFetcher

func NewMockAutoScalerFetcher(addr string) *MockTopoFetcher

NewMockAutoScalerFetcher create a new MockTopoFetcher.

func (*MockTopoFetcher) FetchAndGetTopo

func (f *MockTopoFetcher) FetchAndGetTopo() ([]string, error)

FetchAndGetTopo implements TopoFetcher interface.

func (*MockTopoFetcher) RecoveryAndGetTopo

func (*MockTopoFetcher) RecoveryAndGetTopo(RecoveryType, int) ([]string, error)

RecoveryAndGetTopo implements TopoFetcher interface.

type RecoveryType

type RecoveryType uint32

RecoveryType is for MPPErrRecovery.

const (
	// RecoveryTypeNull means no need to recovery error.
	RecoveryTypeNull RecoveryType = iota
	// RecoveryTypeMemLimit means need to recovery MemLimit error.
	RecoveryTypeMemLimit
)

type TestTopoFetcher

type TestTopoFetcher struct{}

TestTopoFetcher will return empty topo list, just for unit test.

func NewTestAutoScalerFetcher

func NewTestAutoScalerFetcher() *TestTopoFetcher

NewTestAutoScalerFetcher returns TestTopoFetcher.

func (*TestTopoFetcher) FetchAndGetTopo

func (*TestTopoFetcher) FetchAndGetTopo() ([]string, error)

FetchAndGetTopo implements TopoFetcher interface.

func (*TestTopoFetcher) RecoveryAndGetTopo

func (*TestTopoFetcher) RecoveryAndGetTopo(RecoveryType, int) ([]string, error)

RecoveryAndGetTopo implements TopoFetcher interface.

type TopoFetcher

type TopoFetcher interface {
	// Always fetch topo from AutoScaler, then return topo.
	// If topo is empty, will not return error.
	FetchAndGetTopo() ([]string, error)

	// Try recovery error then fetch new topo.
	RecoveryAndGetTopo(recovery RecoveryType, oriCNCnt int) ([]string, error)
}

TopoFetcher is interface for fetching topo from AutoScaler. We support the following kinds of AutoScaler for now:

  1. MockAutoScaler: Normally for test, can run in local environment.
  2. AWSAutoScaler: AutoScaler runs on AWS.
  3. GCPAutoScaler: AutoScaler runs on GCP.
  4. TestAutoScaler: AutoScaler just for unit test.

func GetGlobalTopoFetcher

func GetGlobalTopoFetcher() TopoFetcher

GetGlobalTopoFetcher return global topo fetcher, not thread safe.

Jump to

Keyboard shortcuts

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