Esempio n. 1
0
// ReparentPosition returns the RestartSlaveData for the provided
// ReplicationPosition.
// Should be called under RpcWrap.
func (agent *ActionAgent) ReparentPosition(rp *myproto.ReplicationPosition) (*actionnode.RestartSlaveData, error) {
	replicationStatus, waitPosition, timePromoted, err := agent.Mysqld.ReparentPosition(*rp)
	if err != nil {
		return nil, err
	}
	rsd := new(actionnode.RestartSlaveData)
	rsd.ReplicationStatus = replicationStatus
	rsd.TimePromoted = timePromoted
	rsd.WaitPosition = waitPosition
	rsd.Parent = agent.TabletAlias
	return rsd, nil
}
Esempio n. 2
0
func (ta *TabletActor) reparentPosition(actionNode *actionnode.ActionNode) error {
	slavePos := *actionNode.Args.(*myproto.ReplicationPosition)

	replicationStatus, waitPosition, timePromoted, err := ta.mysqld.ReparentPosition(slavePos)
	if err != nil {
		return err
	}
	rsd := new(actionnode.RestartSlaveData)
	rsd.ReplicationStatus = replicationStatus
	rsd.TimePromoted = timePromoted
	rsd.WaitPosition = waitPosition
	rsd.Parent = ta.tabletAlias
	log.V(6).Infof("reparentPosition: %v", rsd)
	actionNode.Reply = rsd
	return nil
}