本文整理汇总了Golang中github.com/youtube/vitess/go/vt/tabletmanager/actionnode.ActionNode.Reply方法的典型用法代码示例。如果您正苦于以下问题:Golang ActionNode.Reply方法的具体用法?Golang ActionNode.Reply怎么用?Golang ActionNode.Reply使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类github.com/youtube/vitess/go/vt/tabletmanager/actionnode.ActionNode
的用法示例。
在下文中一共展示了ActionNode.Reply方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: snapshot
// Operate on a backup tablet. Shutdown mysqld and copy the data files aside.
func (ta *TabletActor) snapshot(actionNode *actionnode.ActionNode) error {
args := actionNode.Args.(*actionnode.SnapshotArgs)
tablet, err := ta.ts.GetTablet(ta.tabletAlias)
if err != nil {
return err
}
if tablet.Type != topo.TYPE_BACKUP {
return fmt.Errorf("expected backup type, not %v: %v", tablet.Type, ta.tabletAlias)
}
filename, slaveStartRequired, readOnly, err := ta.mysqld.CreateSnapshot(tablet.DbName(), tablet.Addr(), false, args.Concurrency, args.ServerMode, ta.hookExtraEnv())
if err != nil {
return err
}
sr := &actionnode.SnapshotReply{ManifestPath: filename, SlaveStartRequired: slaveStartRequired, ReadOnly: readOnly}
if tablet.Parent.Uid == topo.NO_TABLET {
// If this is a master, this will be the new parent.
// FIXME(msolomon) this doesn't work in hierarchical replication.
sr.ParentAlias = tablet.Alias
} else {
sr.ParentAlias = tablet.Parent
}
actionNode.Reply = sr
return nil
}
示例2: multiSnapshot
func (ta *TabletActor) multiSnapshot(actionNode *actionnode.ActionNode) error {
args := actionNode.Args.(*actionnode.MultiSnapshotArgs)
tablet, err := ta.ts.GetTablet(ta.tabletAlias)
if err != nil {
return err
}
ki, err := ta.ts.GetKeyspace(tablet.Keyspace)
if err != nil {
return err
}
if tablet.Type != topo.TYPE_BACKUP {
return fmt.Errorf("expected backup type, not %v: %v", tablet.Type, ta.tabletAlias)
}
filenames, err := ta.mysqld.CreateMultiSnapshot(args.KeyRanges, tablet.DbName(), ki.ShardingColumnName, ki.ShardingColumnType, tablet.Addr(), false, args.Concurrency, args.Tables, args.SkipSlaveRestart, args.MaximumFilesize, ta.hookExtraEnv())
if err != nil {
return err
}
sr := &actionnode.MultiSnapshotReply{ManifestPaths: filenames}
if tablet.Parent.Uid == topo.NO_TABLET {
// If this is a master, this will be the new parent.
// FIXME(msolomon) this doens't work in hierarchical replication.
sr.ParentAlias = tablet.Alias
} else {
sr.ParentAlias = tablet.Parent
}
actionNode.Reply = sr
return nil
}
示例3: executeHook
func (ta *TabletActor) executeHook(actionNode *actionnode.ActionNode) (err error) {
// FIXME(msolomon) shouldn't the reply get distilled into an error?
h := actionNode.Args.(*hook.Hook)
topotools.ConfigureTabletHook(h, ta.tabletAlias)
actionNode.Reply = h.Execute()
return nil
}
示例4: reparentPosition
func (ta *TabletActor) reparentPosition(actionNode *actionnode.ActionNode) error {
slavePos := actionNode.Args.(*myproto.ReplicationPosition)
replicationState, waitPosition, timePromoted, err := ta.mysqld.ReparentPosition(slavePos)
if err != nil {
return err
}
rsd := new(actionnode.RestartSlaveData)
rsd.ReplicationState = replicationState
rsd.TimePromoted = timePromoted
rsd.WaitPosition = waitPosition
rsd.Parent = ta.tabletAlias
log.V(6).Infof("reparentPosition %v", rsd.String())
actionNode.Reply = rsd
return nil
}
示例5: applySchema
func (ta *TabletActor) applySchema(actionNode *actionnode.ActionNode) error {
sc := actionNode.Args.(*myproto.SchemaChange)
// read the tablet to get the dbname
tablet, err := ta.ts.GetTablet(ta.tabletAlias)
if err != nil {
return err
}
// and apply the change
scr, err := ta.mysqld.ApplySchemaChange(tablet.DbName(), sc)
if err != nil {
return err
}
actionNode.Reply = scr
return nil
}
示例6: preflightSchema
func (ta *TabletActor) preflightSchema(actionNode *actionnode.ActionNode) error {
change := actionNode.Args.(*string)
// read the tablet to get the dbname
tablet, err := ta.ts.GetTablet(ta.tabletAlias)
if err != nil {
return err
}
// and preflight the change
scr, err := ta.mysqld.PreflightSchemaChange(tablet.DbName(), *change)
if err != nil {
return err
}
actionNode.Reply = scr
return nil
}
示例7: promoteSlave
func (ta *TabletActor) promoteSlave(actionNode *actionnode.ActionNode) error {
tablet, err := ta.ts.GetTablet(ta.tabletAlias)
if err != nil {
return err
}
// Perform the action.
rsd := &actionnode.RestartSlaveData{Parent: tablet.Alias, Force: (tablet.Parent.Uid == topo.NO_TABLET)}
rsd.ReplicationState, rsd.WaitPosition, rsd.TimePromoted, err = ta.mysqld.PromoteSlave(false, ta.hookExtraEnv())
if err != nil {
return err
}
log.Infof("PromoteSlave %v", rsd.String())
actionNode.Reply = rsd
return updateReplicationGraphForPromotedSlave(ta.ts, tablet)
}