示例#1
0
文件: schema.go 项目: anusornc/vitess
func (wr *Wrangler) lockAndApplySchemaShard(ctx context.Context, shardInfo *topo.ShardInfo, preflight *myproto.SchemaChangeResult, keyspace, shard string, masterTabletAlias *pb.TabletAlias, change string, newParentTabletAlias *pb.TabletAlias, simple, force bool, waitSlaveTimeout time.Duration) (*myproto.SchemaChangeResult, error) {
	// get a shard lock
	actionNode := actionnode.ApplySchemaShard(masterTabletAlias, change, simple)
	lockPath, err := wr.lockShard(ctx, keyspace, shard, actionNode)
	if err != nil {
		return nil, err
	}

	scr, err := wr.applySchemaShard(ctx, shardInfo, preflight, masterTabletAlias, change, newParentTabletAlias, simple, force, waitSlaveTimeout)
	return scr, wr.unlockShard(ctx, keyspace, shard, actionNode, lockPath, err)
}
示例#2
0
文件: schema.go 项目: kingpro/vitess
func (wr *Wrangler) lockAndApplySchemaShard(shardInfo *topo.ShardInfo, preflight *myproto.SchemaChangeResult, keyspace, shard string, masterTabletAlias topo.TabletAlias, change string, newParentTabletAlias topo.TabletAlias, simple, force bool) (*myproto.SchemaChangeResult, error) {
	// get a shard lock
	actionNode := actionnode.ApplySchemaShard(masterTabletAlias, change, simple)
	lockPath, err := wr.lockShard(keyspace, shard, actionNode)
	if err != nil {
		return nil, err
	}

	scr, err := wr.applySchemaShard(shardInfo, preflight, masterTabletAlias, change, newParentTabletAlias, simple, force)
	return scr, wr.unlockShard(keyspace, shard, actionNode, lockPath, err)
}