本文整理匯總了Golang中github.com/henryanand/vitess/go/vt/wrangler.Wrangler.ReparentShard方法的典型用法代碼示例。如果您正苦於以下問題:Golang Wrangler.ReparentShard方法的具體用法?Golang Wrangler.ReparentShard怎麽用?Golang Wrangler.ReparentShard使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類github.com/henryanand/vitess/go/vt/wrangler.Wrangler
的用法示例。
在下文中一共展示了Wrangler.ReparentShard方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: commandReparentShard
func commandReparentShard(wr *wrangler.Wrangler, subFlags *flag.FlagSet, args []string) error {
leaveMasterReadOnly := subFlags.Bool("leave-master-read-only", false, "leaves the master read-only after reparenting")
force := subFlags.Bool("force", false, "will force the reparent even if the master is already correct")
if err := subFlags.Parse(args); err != nil {
return err
}
if subFlags.NArg() != 2 {
return fmt.Errorf("action ReparentShard requires <keyspace/shard|zk shard path> <tablet alias|zk tablet path>")
}
keyspace, shard, err := shardParamToKeyspaceShard(subFlags.Arg(0))
if err != nil {
return err
}
tabletAlias, err := tabletParamToTabletAlias(subFlags.Arg(1))
if err != nil {
return err
}
return wr.ReparentShard(keyspace, shard, tabletAlias, *leaveMasterReadOnly, *force)
}