Documentation ¶
Index ¶
- Constants
- Variables
- func NewSession(ctx context.Context, logPrefix string, etcdCli *clientv3.Client, ...) (*concurrency.Session, error)
- type InfoSyncer
- func (is *InfoSyncer) Done() <-chan struct{}
- func (is *InfoSyncer) RemoveMinStartTS()
- func (is *InfoSyncer) RemoveServerInfo()
- func (is *InfoSyncer) ReportMinStartTS(store kv.Storage)
- func (is *InfoSyncer) Restart(ctx context.Context) error
- func (is *InfoSyncer) RestartTopology(ctx context.Context) error
- func (is *InfoSyncer) StoreTopologyInfo(ctx context.Context) error
- func (is *InfoSyncer) TopologyDone() <-chan struct{}
- type ServerInfo
- type ServerVersionInfo
Constants ¶
const (
NewSessionDefaultRetryCnt = 3
)
Variables ¶
var ( // 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" // InfoSessionTTL is the ETCD session's TTL in seconds. InfoSessionTTL = 10 * 60 // 10 minutes // ReportInterval is interval of infoSyncerKeeper reporting min startTS. ReportInterval = 30 * time.Second // TopologyInformationPath means etcd path for storing topology info. TopologyInformationPath = "/topology/tidb" // TopologyInfoZettaPath means etcd path for storing zetta topology info. TopologyInfoZettaPath = "/topology/zetta" // 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 )
Functions ¶
Types ¶
type InfoSyncer ¶
type InfoSyncer struct {
// contains filtered or unexported fields
}
func GlobalInfoSyncerInit ¶
func GlobalInfoSyncerInit(ctx context.Context, id string, etcdCli *clientv3.Client) (*InfoSyncer, error)
GlobalInfoSyncerInit return a new InfoSyncer. It is exported for testing.
func (*InfoSyncer) Done ¶
func (is *InfoSyncer) Done() <-chan struct{}
Done returns a channel that closes when the info syncer is no longer being refreshed.
func (*InfoSyncer) RemoveMinStartTS ¶
func (is *InfoSyncer) RemoveMinStartTS()
RemoveMinStartTS removes self server min start timestamp from etcd.
func (*InfoSyncer) RemoveServerInfo ¶
func (is *InfoSyncer) RemoveServerInfo()
RemoveServerInfo remove self server static information from etcd.
func (*InfoSyncer) ReportMinStartTS ¶
func (is *InfoSyncer) ReportMinStartTS(store kv.Storage)
ReportMinStartTS reports self server min start timestamp to ETCD.
func (*InfoSyncer) Restart ¶
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 ¶
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) StoreTopologyInfo ¶
func (is *InfoSyncer) StoreTopologyInfo(ctx context.Context) error
StoreTopologyInfo stores the topology of tidb to etcd.
func (*InfoSyncer) TopologyDone ¶
func (is *InfoSyncer) TopologyDone() <-chan struct{}
TopologyDone returns a channel that closes when the topology syncer is no longer being refreshed.
type ServerInfo ¶
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"` }
ServerInfo is server static information. It will not be updated when tidb-server running. So please only put static information in ServerInfo struct.
func GetServerInfoByID ¶
func GetServerInfoByID(ctx context.Context, id string) (*ServerInfo, error)
GetServerInfoByID gets specified server static information from etcd.
type ServerVersionInfo ¶
ServerVersionInfo is the server version and git_hash.