Documentation ¶
Index ¶
- Constants
- Variables
- func CheckTabletMysqlPort(ts topo.Server, mysqlDaemon mysqlctl.MysqlDaemon, tablet *topo.TabletInfo) *topo.TabletInfo
- func RegisterBinlogPlayerMap(blm *BinlogPlayerMap)
- func SetBlacklistedTables(ts topo.Server, tabletAlias topo.TabletAlias, tables []string) error
- func SlaveWasPromoted(ts topo.Server, tabletAlias topo.TabletAlias) error
- func SlaveWasRestarted(ts topo.Server, tabletAlias topo.TabletAlias, ...) error
- func StoreActionResponse(ts topo.Server, actionNode *actionnode.ActionNode, actionPath string, ...) error
- type ActionAgent
- func (agent *ActionAgent) AddChangeCallback(f TabletChangeCallback)
- func (agent *ActionAgent) RegisterQueryService()
- func (agent *ActionAgent) RpcWrap(from, name string, args, reply interface{}, f func() error) error
- func (agent *ActionAgent) RpcWrapLock(from, name string, args, reply interface{}, f func() error) error
- func (agent *ActionAgent) RpcWrapLockAction(from, name string, args, reply interface{}, f func() error) error
- func (agent *ActionAgent) RpcWrapLockActionSchema(from, name string, args, reply interface{}, f func() error) error
- func (agent *ActionAgent) RunHealthCheck(targetTabletType topo.TabletType, lockTimeout time.Duration)
- func (agent *ActionAgent) Start(mysqlPort, vtPort, vtsPort int) error
- func (agent *ActionAgent) Stop()
- func (agent *ActionAgent) Tablet() *topo.TabletInfo
- type BinlogPlayerController
- func (bpc *BinlogPlayerController) BlpPosition(vtClient *binlogplayer.DBClient) (*myproto.BlpPosition, error)
- func (bpc *BinlogPlayerController) DisableSuperToSetTimestamp()
- func (bpc *BinlogPlayerController) Iteration() (err error)
- func (bpc *BinlogPlayerController) Loop()
- func (bpc *BinlogPlayerController) Start()
- func (bpc *BinlogPlayerController) StartUntil(groupId int64) error
- func (bpc *BinlogPlayerController) Stop()
- func (bpc *BinlogPlayerController) String() string
- func (bpc *BinlogPlayerController) WaitForStop(waitTimeout time.Duration) error
- type BinlogPlayerMap
- func (blm *BinlogPlayerMap) BlpPositionList() (*myproto.BlpPositionList, error)
- func (blm *BinlogPlayerMap) RefreshMap(tablet topo.Tablet, keyspaceInfo *topo.KeyspaceInfo, shardInfo *topo.ShardInfo)
- func (blm *BinlogPlayerMap) RunUntil(blpPositionList *myproto.BlpPositionList, waitTimeout time.Duration) error
- func (blm *BinlogPlayerMap) Start()
- func (blm *BinlogPlayerMap) Stop()
- func (blm *BinlogPlayerMap) StopAllPlayersAndReset()
- type RegisterQueryService
- type TabletActor
- type TabletActorError
- type TabletChangeCallback
Constants ¶
const ( BPM_STATE_RUNNING int64 = iota BPM_STATE_STOPPED )
Variables ¶
var RegisterQueryServices []RegisterQueryService
Functions ¶
func CheckTabletMysqlPort ¶
func CheckTabletMysqlPort(ts topo.Server, mysqlDaemon mysqlctl.MysqlDaemon, tablet *topo.TabletInfo) *topo.TabletInfo
ChecktabletMysqlPort will check the mysql port for the tablet is good, and if not will try to update it
func RegisterBinlogPlayerMap ¶
func RegisterBinlogPlayerMap(blm *BinlogPlayerMap)
func SetBlacklistedTables ¶
Make this external, since these transitions need to be forced from time to time.
func SlaveWasPromoted ¶
func SlaveWasPromoted(ts topo.Server, tabletAlias topo.TabletAlias) error
func SlaveWasRestarted ¶
func SlaveWasRestarted(ts topo.Server, tabletAlias topo.TabletAlias, swrd *actionnode.SlaveWasRestartedArgs) error
func StoreActionResponse ¶
func StoreActionResponse(ts topo.Server, actionNode *actionnode.ActionNode, actionPath string, actionErr error) error
Write the result of an action into topology server
Types ¶
type ActionAgent ¶
type ActionAgent struct { TopoServer topo.Server TabletAlias topo.TabletAlias Mysqld *mysqlctl.Mysqld BinlogPlayerMap *BinlogPlayerMap // optional // contains filtered or unexported fields }
func NewActionAgent ¶
func NewActionAgent(topoServer topo.Server, tabletAlias topo.TabletAlias, mysqld *mysqlctl.Mysqld) (*ActionAgent, error)
func (*ActionAgent) AddChangeCallback ¶
func (agent *ActionAgent) AddChangeCallback(f TabletChangeCallback)
func (*ActionAgent) RegisterQueryService ¶
func (agent *ActionAgent) RegisterQueryService()
RegisterQueryService will register all the instances
func (*ActionAgent) RpcWrap ¶
func (agent *ActionAgent) RpcWrap(from, name string, args, reply interface{}, f func() error) error
func (*ActionAgent) RpcWrapLock ¶
func (agent *ActionAgent) RpcWrapLock(from, name string, args, reply interface{}, f func() error) error
func (*ActionAgent) RpcWrapLockAction ¶
func (agent *ActionAgent) RpcWrapLockAction(from, name string, args, reply interface{}, f func() error) error
func (*ActionAgent) RpcWrapLockActionSchema ¶
func (agent *ActionAgent) RpcWrapLockActionSchema(from, name string, args, reply interface{}, f func() error) error
func (*ActionAgent) RunHealthCheck ¶
func (agent *ActionAgent) RunHealthCheck(targetTabletType topo.TabletType, lockTimeout time.Duration)
RunHealthCheck takes the action mutex, runs the health check, and if we need to change our state, do it. If we are the master, we don't change our type, healthy or not. If we are not the master, we change to spare if not healthy, or to the passed in targetTabletType if healthy.
Note we only update the topo record if we need to, that is if our type or health details changed.
func (*ActionAgent) Start ¶
func (agent *ActionAgent) Start(mysqlPort, vtPort, vtsPort int) error
bindAddr: the address for the query service advertised by this agent
func (*ActionAgent) Stop ¶
func (agent *ActionAgent) Stop()
func (*ActionAgent) Tablet ¶
func (agent *ActionAgent) Tablet() *topo.TabletInfo
type BinlogPlayerController ¶
type BinlogPlayerController struct {
// contains filtered or unexported fields
}
BinlogPlayerController controls one player
func NewBinlogPlayerController ¶
func NewBinlogPlayerController(ts topo.Server, dbConfig *mysql.ConnectionParams, mysqld *mysqlctl.Mysqld, cell string, keyspaceIdType key.KeyspaceIdType, keyRange key.KeyRange, sourceShard topo.SourceShard) *BinlogPlayerController
func (*BinlogPlayerController) BlpPosition ¶
func (bpc *BinlogPlayerController) BlpPosition(vtClient *binlogplayer.DBClient) (*myproto.BlpPosition, error)
func (*BinlogPlayerController) DisableSuperToSetTimestamp ¶
func (bpc *BinlogPlayerController) DisableSuperToSetTimestamp()
func (*BinlogPlayerController) Iteration ¶
func (bpc *BinlogPlayerController) Iteration() (err error)
func (*BinlogPlayerController) Loop ¶
func (bpc *BinlogPlayerController) Loop()
func (*BinlogPlayerController) Start ¶
func (bpc *BinlogPlayerController) Start()
Start will start the player in the background and run forever
func (*BinlogPlayerController) StartUntil ¶
func (bpc *BinlogPlayerController) StartUntil(groupId int64) error
StartUntil will start the Player until we reach the given groupId
func (*BinlogPlayerController) Stop ¶
func (bpc *BinlogPlayerController) Stop()
func (*BinlogPlayerController) String ¶
func (bpc *BinlogPlayerController) String() string
func (*BinlogPlayerController) WaitForStop ¶
func (bpc *BinlogPlayerController) WaitForStop(waitTimeout time.Duration) error
WaitForStop will wait until the player is stopped. Use this after StartUntil.
type BinlogPlayerMap ¶
type BinlogPlayerMap struct {
// contains filtered or unexported fields
}
BinlogPlayerMap controls all the players. It can be stopped and restarted.
func NewBinlogPlayerMap ¶
func NewBinlogPlayerMap(ts topo.Server, dbConfig *mysql.ConnectionParams, mysqld *mysqlctl.Mysqld) *BinlogPlayerMap
func (*BinlogPlayerMap) BlpPositionList ¶
func (blm *BinlogPlayerMap) BlpPositionList() (*myproto.BlpPositionList, error)
BlpPositionList returns the current position of all the players
func (*BinlogPlayerMap) RefreshMap ¶
func (blm *BinlogPlayerMap) RefreshMap(tablet topo.Tablet, keyspaceInfo *topo.KeyspaceInfo, shardInfo *topo.ShardInfo)
RefreshMap reads the right data from topo.Server and makes sure we're playing the right logs.
func (*BinlogPlayerMap) RunUntil ¶
func (blm *BinlogPlayerMap) RunUntil(blpPositionList *myproto.BlpPositionList, waitTimeout time.Duration) error
RunUntil will run all the players until they reach the given position. Holds the map lock during that exercise, shouldn't take long at all.
func (*BinlogPlayerMap) Start ¶
func (blm *BinlogPlayerMap) Start()
Start restarts the current players
func (*BinlogPlayerMap) Stop ¶
func (blm *BinlogPlayerMap) Stop()
Stop stops the current players, but does not remove them from the map. Call 'Start' to restart the playback.
func (*BinlogPlayerMap) StopAllPlayersAndReset ¶
func (blm *BinlogPlayerMap) StopAllPlayersAndReset()
StopAllPlayersAndReset stops all the binlog players, and reset the map of players.
type RegisterQueryService ¶
type RegisterQueryService func(*ActionAgent)
type TabletActor ¶
type TabletActor struct {
// contains filtered or unexported fields
}
func NewTabletActor ¶
func NewTabletActor(mysqld *mysqlctl.Mysqld, mysqlDaemon mysqlctl.MysqlDaemon, topoServer topo.Server, tabletAlias topo.TabletAlias) *TabletActor
func (*TabletActor) HandleAction ¶
func (ta *TabletActor) HandleAction(actionPath, action, actionGuid string, forceRerun bool) error
This function should be protected from unforseen panics, as dispatchAction will catch everything. The rest of the code in this function should not panic.
type TabletActorError ¶
type TabletActorError string
func (TabletActorError) Error ¶
func (e TabletActorError) Error() string
type TabletChangeCallback ¶
Each TabletChangeCallback must be idempotent and "threadsafe". The agent will execute these in a new goroutine each time a change is triggered. We won't run two in parallel.