pdutil

package
v4.0.9+incompatible Latest Latest
Warning

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

Go to latest
Published: Dec 15, 2020 License: Apache-2.0 Imports: 26 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (

	// Schedulers represent region/leader schedulers which can impact on performance.
	Schedulers = map[string]struct{}{
		"balance-leader-scheduler":     {},
		"balance-hot-region-scheduler": {},
		"balance-region-scheduler":     {},

		"shuffle-leader-scheduler":     {},
		"shuffle-region-scheduler":     {},
		"shuffle-hot-region-scheduler": {},
	}
)

Functions

func GetPlacementRules

func GetPlacementRules(ctx context.Context, pdAddr string, tlsConf *tls.Config) ([]placement.Rule, error)

GetPlacementRules return the current placement rules.

func ResetTS

func ResetTS(ctx context.Context, pdAddr string, ts uint64, tlsConf *tls.Config) error

ResetTS resets the timestamp of PD to a bigger value.

func SearchPlacementRule

func SearchPlacementRule(tableID int64, placementRules []placement.Rule, role placement.PeerRoleType) *placement.Rule

SearchPlacementRule returns the placement rule matched to the table or nil.

Types

type PdController

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

PdController manage get/update config from pd.

func NewPdController

func NewPdController(
	ctx context.Context,
	pdAddrs string,
	tlsConf *tls.Config,
	securityOption pd.SecurityOption,
) (*PdController, error)

NewPdController creates a new PdController.

func (*PdController) Close

func (p *PdController) Close()

Close close the connection to pd.

func (*PdController) GetClusterVersion

func (p *PdController) GetClusterVersion(ctx context.Context) (string, error)

GetClusterVersion returns the current cluster version.

func (*PdController) GetPDClient

func (p *PdController) GetPDClient() pd.Client

GetPDClient set pd addrs and cli for test.

func (*PdController) GetPDScheduleConfig

func (p *PdController) GetPDScheduleConfig(
	ctx context.Context,
) (map[string]interface{}, error)

GetPDScheduleConfig returns PD schedule config value associated with the key. It returns nil if there is no such config item.

func (*PdController) GetRegionCount

func (p *PdController) GetRegionCount(ctx context.Context, startKey, endKey []byte) (int, error)

GetRegionCount returns the region count in the specified range.

func (*PdController) ListSchedulers

func (p *PdController) ListSchedulers(ctx context.Context) ([]string, error)

ListSchedulers list all pd scheduler.

func (*PdController) RemoveSchedulers

func (p *PdController) RemoveSchedulers(ctx context.Context) (undo UndoFunc, err error)

RemoveSchedulers removes the schedulers that may slow down BR speed.

func (*PdController) ResumeSchedulers

func (p *PdController) ResumeSchedulers(ctx context.Context, schedulers []string) error

ResumeSchedulers resume pd scheduler.

func (*PdController) SetHTTP

func (p *PdController) SetHTTP(addrs []string, cli *http.Client)

SetHTTP set pd addrs and cli for test.

func (*PdController) SetPDClient

func (p *PdController) SetPDClient(pdClient pd.Client)

SetPDClient set pd addrs and cli for test.

func (*PdController) UpdatePDScheduleConfig

func (p *PdController) UpdatePDScheduleConfig(ctx context.Context) error

UpdatePDScheduleConfig updates PD schedule config value associated with the key.

type UndoFunc

type UndoFunc func(context.Context) error

UndoFunc is a 'undo' operation of some undoable command. (e.g. RemoveSchedulers).

var Nop UndoFunc = func(context.Context) error { return nil }

Nop is the 'zero value' of undo func.

Jump to

Keyboard shortcuts

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