conn

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

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

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

Documentation

Index

Constants

View Source
const (
	// DefaultMergeRegionSizeBytes is the default region split size, 96MB.
	// See https://github.com/tikv/tikv/blob/v4.0.8/components/raftstore/src/coprocessor/config.rs#L35-L38
	DefaultMergeRegionSizeBytes uint64 = 96 * units.MiB

	// DefaultMergeRegionKeyCount is the default region key count, 960000.
	DefaultMergeRegionKeyCount uint64 = 960000

	// DefaultImportNumGoroutines is the default number of threads for import.
	// use 128 as default value, which is 8 times of the default value of tidb.
	// we think is proper for IO-bound cases.
	DefaultImportNumGoroutines uint = 128
)

Variables

This section is empty.

Functions

func GetAllTiKVStoresWithRetry

func GetAllTiKVStoresWithRetry(ctx context.Context,
	pdClient util.StoreMeta,
	storeBehavior util.StoreBehavior,
) ([]*metapb.Store, error)

Types

type Mgr

type Mgr struct {
	*pdutil.PdController

	*utils.StoreManager
	// contains filtered or unexported fields
}

Mgr manages connections to a TiDB cluster.

func NewMgr

func NewMgr(
	ctx context.Context,
	g glue.Glue,
	pdAddrs []string,
	tlsConf *tls.Config,
	securityOption pd.SecurityOption,
	keepalive keepalive.ClientParameters,
	storeBehavior util.StoreBehavior,
	checkRequirements bool,
	needDomain bool,
	versionCheckerType VersionCheckerType,
) (*Mgr, error)

NewMgr creates a new Mgr.

Domain is optional for Backup, set `needDomain` to false to disable initializing Domain.

func (*Mgr) Close

func (mgr *Mgr) Close()

func (*Mgr) GetBackupClient

func (mgr *Mgr) GetBackupClient(ctx context.Context, storeID uint64) (backuppb.BackupClient, error)

GetBackupClient get or create a backup client.

func (*Mgr) GetConfigFromTiKV

func (mgr *Mgr) GetConfigFromTiKV(ctx context.Context, cli *http.Client, fn func(*http.Response) error) error

GetConfigFromTiKV get configs from all alive tikv stores.

func (*Mgr) GetCurrentTsFromPD

func (mgr *Mgr) GetCurrentTsFromPD(ctx context.Context) (uint64, error)

GetCurrentTsFromPD gets current ts from PD.

func (*Mgr) GetDomain

func (mgr *Mgr) GetDomain() *domain.Domain

GetDomain returns a tikv storage.

func (*Mgr) GetLockResolver

func (mgr *Mgr) GetLockResolver() *txnlock.LockResolver

GetLockResolver gets the LockResolver.

func (*Mgr) GetLogBackupClient

func (mgr *Mgr) GetLogBackupClient(ctx context.Context, storeID uint64) (logbackup.LogBackupClient, error)

func (*Mgr) GetStorage

func (mgr *Mgr) GetStorage() kv.Storage

GetStorage returns a kv storage.

func (*Mgr) GetStore

func (mgr *Mgr) GetStore() tikv.Storage

GetStore gets the tikvStore.

func (*Mgr) GetTLSConfig

func (mgr *Mgr) GetTLSConfig() *tls.Config

GetTLSConfig returns the tls config.

func (*Mgr) IsLogBackupEnabled

func (mgr *Mgr) IsLogBackupEnabled(ctx context.Context, client *http.Client) (bool, error)

IsLogBackupEnabled is used for br to check whether tikv has enabled log backup.

func (*Mgr) ProcessTiKVConfigs

func (mgr *Mgr) ProcessTiKVConfigs(ctx context.Context, cfg *kvconfig.KVConfig, client *http.Client)

ProcessTiKVConfigs handle the tikv config for region split size, region split keys, and import goroutines in place. It retrieves the config from all alive tikv stores and returns the minimum values. If retrieving the config fails, it returns the default config values.

type VersionCheckerType

type VersionCheckerType int
const (
	// default version checker
	NormalVersionChecker VersionCheckerType = iota
	// version checker for PiTR
	StreamVersionChecker
	// no check
	NoVersionChecker
)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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