зеркало из https://github.com/github/vitess-gh.git
Adding a check to ShardMultiRestore.
This commit is contained in:
Родитель
a0b4b67be0
Коммит
a8e25ab7c7
|
@ -134,6 +134,10 @@ func (wr *Wrangler) ShardMultiRestore(keyspace, shard string, sources []topo.Tab
|
|||
mrErr := wr.SetSourceShards(keyspace, shard, sources, tables)
|
||||
err = wr.unlockShard(keyspace, shard, actionNode, lockPath, mrErr)
|
||||
if err != nil {
|
||||
if mrErr != nil {
|
||||
log.Errorf("unlockShard got error back: %v", err)
|
||||
return mrErr
|
||||
}
|
||||
return err
|
||||
}
|
||||
if mrErr != nil {
|
||||
|
@ -171,6 +175,12 @@ func (wr *Wrangler) SetSourceShards(keyspace, shard string, sources []topo.Table
|
|||
return err
|
||||
}
|
||||
|
||||
// If the shard already has sources, maybe it's already been restored,
|
||||
// so let's be safe and abort right here.
|
||||
if len(shardInfo.SourceShards) > 0 {
|
||||
return fmt.Errorf("Shard %v/%v already has SourceShards, not performing the MultiRestore")
|
||||
}
|
||||
|
||||
// read the source tablets
|
||||
sourceTablets, err := topo.GetTabletMap(wr.TopoServer(), sources)
|
||||
if err != nil {
|
||||
|
|
Загрузка…
Ссылка в новой задаче