conn

package
v0.0.0-...-503c688 Latest Latest
Warning

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

Go to latest
Published: Nov 8, 2023 License: Apache-2.0, Apache-2.0 Imports: 35 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
)

Variables

This section is empty.

Functions

func GetAllTiKVStoresWithRetry

func GetAllTiKVStoresWithRetry(ctx context.Context,
	pdClient pd.Client,
	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) 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) GetMergeRegionSizeAndCount

func (mgr *Mgr) GetMergeRegionSizeAndCount(ctx context.Context, client *http.Client) (uint64, uint64)

GetMergeRegionSizeAndCount returns the tikv config `coprocessor.region-split-size` and `coprocessor.region-split-key`. returns the default config when failed.

func (*Mgr) GetStorage

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

GetStorage returns a kv storage.

func (*Mgr) GetTLSConfig

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

GetTLSConfig returns the tls config.

func (*Mgr) GetTS

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

GetTS gets current ts from pd.

type VersionCheckerType

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

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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