tidb: github.com/pingcap/tidb/domain/infosync Index | Files

package infosync

import "github.com/pingcap/tidb/domain/infosync"

Index

Package Files

info.go

Constants

const (
    // ServerInformationPath store server information such as IP, port and so on.
    ServerInformationPath = "/tidb/server/info"
    // ServerMinStartTSPath store the server min start timestamp.
    ServerMinStartTSPath = "/tidb/server/minstartts"
    // TiFlashTableSyncProgressPath store the tiflash table replica sync progress.
    TiFlashTableSyncProgressPath = "/tiflash/table/sync"

    // InfoSessionTTL is the ETCD session's TTL in seconds.
    InfoSessionTTL = 10 * 60
    // ReportInterval is interval of infoSyncerKeeper reporting min startTS.
    ReportInterval = 30 * time.Second
    // TopologyInformationPath means etcd path for storing topology info.
    TopologyInformationPath = "/topology/tidb"
    // TopologySessionTTL is ttl for topology, ant it's the ETCD session's TTL in seconds.
    TopologySessionTTL = 45
    // TopologyTimeToRefresh means time to refresh etcd.
    TopologyTimeToRefresh = 30 * time.Second
    // TopologyPrometheus means address of prometheus.
    TopologyPrometheus = "/topology/prometheus"
    // TablePrometheusCacheExpiry is the expiry time for prometheus address cache.
    TablePrometheusCacheExpiry = 10 * time.Second
)

Variables

var ErrPrometheusAddrIsNotSet = dbterror.ClassDomain.NewStd(errno.ErrPrometheusAddrIsNotSet)

ErrPrometheusAddrIsNotSet is the error that Prometheus address is not set in PD and etcd

func DeleteTiFlashTableSyncProgress Uses

func DeleteTiFlashTableSyncProgress(tid int64) error

DeleteTiFlashTableSyncProgress is used to delete the tiflash table replica sync progress.

func GetAllRuleBundles Uses

func GetAllRuleBundles(ctx context.Context) ([]*placement.Bundle, error)

GetAllRuleBundles is used to get all rule bundles from PD. It is used to load full rules from PD while fullload infoschema.

func GetAllServerInfo Uses

func GetAllServerInfo(ctx context.Context) (map[string]*ServerInfo, error)

GetAllServerInfo gets all servers static information from etcd.

func GetPrometheusAddr Uses

func GetPrometheusAddr() (string, error)

GetPrometheusAddr gets prometheus Address

func GetRuleBundle Uses

func GetRuleBundle(ctx context.Context, name string) (*placement.Bundle, error)

GetRuleBundle is used to get one specific rule bundle from PD.

func GetTiFlashTableSyncProgress Uses

func GetTiFlashTableSyncProgress(ctx context.Context) (map[int64]float64, error)

GetTiFlashTableSyncProgress uses to get all the tiflash table replica sync progress.

func PutRuleBundles Uses

func PutRuleBundles(ctx context.Context, bundles []*placement.Bundle) error

PutRuleBundles is used to post specific rule bundles to PD.

func UpdateTiFlashTableSyncProgress Uses

func UpdateTiFlashTableSyncProgress(ctx context.Context, tid int64, progress float64) error

UpdateTiFlashTableSyncProgress is used to update the tiflash table replica sync progress.

type InfoSyncer Uses

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

InfoSyncer stores server info to etcd when the tidb-server starts and delete when tidb-server shuts down.

func GlobalInfoSyncerInit Uses

func GlobalInfoSyncerInit(ctx context.Context, id string, serverIDGetter func() uint64, etcdCli *clientv3.Client, skipRegisterToDashBoard bool) (*InfoSyncer, error)

GlobalInfoSyncerInit return a new InfoSyncer. It is exported for testing.

func (*InfoSyncer) Done Uses

func (is *InfoSyncer) Done() <-chan struct{}

Done returns a channel that closes when the info syncer is no longer being refreshed.

func (*InfoSyncer) GetMinStartTS Uses

func (is *InfoSyncer) GetMinStartTS() uint64

GetMinStartTS get min start timestamp. Export for testing.

func (*InfoSyncer) GetSessionManager Uses

func (is *InfoSyncer) GetSessionManager() util2.SessionManager

GetSessionManager get the session manager.

func (*InfoSyncer) RemoveMinStartTS Uses

func (is *InfoSyncer) RemoveMinStartTS()

RemoveMinStartTS removes self server min start timestamp from etcd.

func (*InfoSyncer) RemoveServerInfo Uses

func (is *InfoSyncer) RemoveServerInfo()

RemoveServerInfo remove self server static information from etcd.

func (*InfoSyncer) ReportMinStartTS Uses

func (is *InfoSyncer) ReportMinStartTS(store kv.Storage)

ReportMinStartTS reports self server min start timestamp to ETCD.

func (*InfoSyncer) Restart Uses

func (is *InfoSyncer) Restart(ctx context.Context) error

Restart restart the info syncer with new session leaseID and store server info to etcd again.

func (*InfoSyncer) RestartTopology Uses

func (is *InfoSyncer) RestartTopology(ctx context.Context) error

RestartTopology restart the topology syncer with new session leaseID and store server info to etcd again.

func (*InfoSyncer) SetSessionManager Uses

func (is *InfoSyncer) SetSessionManager(manager util2.SessionManager)

SetSessionManager set the session manager for InfoSyncer.

func (*InfoSyncer) StoreServerInfo Uses

func (is *InfoSyncer) StoreServerInfo(ctx context.Context) error

StoreServerInfo stores self server static information to etcd.

func (*InfoSyncer) StoreTopologyInfo Uses

func (is *InfoSyncer) StoreTopologyInfo(ctx context.Context) error

StoreTopologyInfo stores the topology of tidb to etcd.

func (*InfoSyncer) TopologyDone Uses

func (is *InfoSyncer) TopologyDone() <-chan struct{}

TopologyDone returns a channel that closes when the topology syncer is no longer being refreshed.

type ServerInfo Uses

type ServerInfo struct {
    ServerVersionInfo
    ID             string            `json:"ddl_id"`
    IP             string            `json:"ip"`
    Port           uint              `json:"listening_port"`
    StatusPort     uint              `json:"status_port"`
    Lease          string            `json:"lease"`
    BinlogStatus   string            `json:"binlog_status"`
    StartTimestamp int64             `json:"start_timestamp"`
    Labels         map[string]string `json:"labels"`
    // ServerID is a function, to always retrieve latest serverID from `Domain`,
    //   which will be changed on occasions such as connection to PD is restored after broken.
    ServerIDGetter func() uint64 `json:"-"`

    // JSONServerID is `serverID` for json marshal/unmarshal ONLY.
    JSONServerID uint64 `json:"server_id"`
}

ServerInfo is server static information. It will not be updated when tidb-server running. So please only put static information in ServerInfo struct.

func GetServerInfo Uses

func GetServerInfo() (*ServerInfo, error)

GetServerInfo gets self server static information.

func GetServerInfoByID Uses

func GetServerInfoByID(ctx context.Context, id string) (*ServerInfo, error)

GetServerInfoByID gets specified server static information from etcd.

func (*ServerInfo) Marshal Uses

func (info *ServerInfo) Marshal() ([]byte, error)

Marshal `ServerInfo` into bytes.

func (*ServerInfo) Unmarshal Uses

func (info *ServerInfo) Unmarshal(v []byte) error

Unmarshal `ServerInfo` from bytes.

type ServerVersionInfo Uses

type ServerVersionInfo struct {
    Version string `json:"version"`
    GitHash string `json:"git_hash"`
}

ServerVersionInfo is the server version and git_hash.

Package infosync imports 35 packages (graph) and is imported by 20 packages. Updated 2021-01-25. Refresh now. Tools for package owners.