Documentation ¶
Index ¶
Constants ¶
View Source
const ( // NewSessionDefaultRetryCnt is the default retry times when create new session. NewSessionDefaultRetryCnt = 3 // NewSessionRetryUnlimited is the unlimited retry times when create new session. NewSessionRetryUnlimited = math.MaxInt64 )
Variables ¶
View Source
var ManagerSessionTTL = 60
ManagerSessionTTL is the etcd session's TTL in seconds. It's exported for testing.
Functions ¶
func GetOwnerInfo ¶
func GetOwnerInfo(ctx context.Context, elec *concurrency.Election, logPrefix, id string) (string, error)
GetOwnerInfo gets the owner information.
Types ¶
type DDLOwnerChecker ¶
type DDLOwnerChecker interface { // IsOwner returns whether the ownerManager is the owner. IsOwner() bool }
DDLOwnerChecker is used to check whether tidb is owner.
type Manager ¶
type Manager interface { // ID returns the ID of the manager. ID() string // IsOwner returns whether the ownerManager is the owner. IsOwner() bool // RetireOwner make the manager to be a not owner. It's exported for testing. RetireOwner() // GetOwnerID gets the owner ID. GetOwnerID(ctx context.Context) (string, error) // CampaignOwner campaigns the owner. CampaignOwner(ctx context.Context) error // ResignOwner lets the owner start a new election. ResignOwner(ctx context.Context) error // Cancel cancels this etcd ownerManager campaign. Cancel() }
Manager is used to campaign the owner and manage the owner information.
func NewMockManager ¶
func NewMockManager(id string, cancel context.CancelFunc) Manager
NewMockManager creates a new mock Manager.
func NewOwnerManager ¶
func NewOwnerManager(etcdCli *clientv3.Client, prompt, id, key string, cancel context.CancelFunc) Manager
NewOwnerManager creates a new Manager.
Click to show internal directories.
Click to hide internal directories.