本文整理汇总了Golang中github.com/youtube/vitess/go/vt/tabletmanager/actionnode.ReparentShard函数的典型用法代码示例。如果您正苦于以下问题:Golang ReparentShard函数的具体用法?Golang ReparentShard怎么用?Golang ReparentShard使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了ReparentShard函数的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Golang代码示例。
示例1: ReparentShard
// ReparentShard creates the reparenting action and launches a goroutine
// to coordinate the procedure.
//
//
// leaveMasterReadOnly: leave the master in read-only mode, even
// though all the other necessary updates have been made.
// forceReparentToCurrentMaster: mostly for test setups, this can
// cause data loss.
func (wr *Wrangler) ReparentShard(keyspace, shard string, masterElectTabletAlias topo.TabletAlias, leaveMasterReadOnly, forceReparentToCurrentMaster bool) error {
// lock the shard
actionNode := actionnode.ReparentShard(masterElectTabletAlias)
lockPath, err := wr.lockShard(keyspace, shard, actionNode)
if err != nil {
return err
}
// do the work
err = wr.reparentShardLocked(keyspace, shard, masterElectTabletAlias, leaveMasterReadOnly, forceReparentToCurrentMaster)
// and unlock
return wr.unlockShard(keyspace, shard, actionNode, lockPath, err)
}
开发者ID:chinna1986,项目名称:vitess,代码行数:22,代码来源:reparent.go
示例2: EmergencyReparentShard
// EmergencyReparentShard will make the provided tablet the master for
// the shard, when the old master is completely unreachable.
func (wr *Wrangler) EmergencyReparentShard(ctx context.Context, keyspace, shard string, masterElectTabletAlias *pb.TabletAlias, waitSlaveTimeout time.Duration) error {
// lock the shard
actionNode := actionnode.ReparentShard(emergencyReparentShardOperation, masterElectTabletAlias)
lockPath, err := wr.lockShard(ctx, keyspace, shard, actionNode)
if err != nil {
return err
}
// Create reusable Reparent event with available info
ev := &events.Reparent{}
// do the work
err = wr.emergencyReparentShardLocked(ctx, ev, keyspace, shard, masterElectTabletAlias, waitSlaveTimeout)
if err != nil {
event.DispatchUpdate(ev, "failed EmergencyReparentShard: "+err.Error())
} else {
event.DispatchUpdate(ev, "finished EmergencyReparentShard")
}
// and unlock
return wr.unlockShard(ctx, keyspace, shard, actionNode, lockPath, err)
}
开发者ID:richarwu,项目名称:vitess,代码行数:24,代码来源:reparent.go
注:本文中的github.com/youtube/vitess/go/vt/tabletmanager/actionnode.ReparentShard函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论