зеркало из https://github.com/github/vitess-gh.git
Handling a race condition better, and better error message.
This commit is contained in:
Родитель
810aca09a3
Коммит
651e804fc7
|
@ -156,10 +156,11 @@ func NewActionAgent(
|
|||
|
||||
// try to initialize the tablet if we have to
|
||||
if err := agent.InitTablet(port, securePort); err != nil {
|
||||
return nil, err
|
||||
return nil, fmt.Errorf("agent.InitTablet failed: %v", err)
|
||||
}
|
||||
|
||||
// Publish and set the TargetTabletType. Not a global var since it should never be changed.
|
||||
// Publish and set the TargetTabletType. Not a global var
|
||||
// since it should never be changed.
|
||||
statsTabletType := stats.NewString("TargetTabletType")
|
||||
statsTabletType.Set(*targetTabletType)
|
||||
|
||||
|
|
|
@ -97,8 +97,10 @@ func (agent *ActionAgent) InitTablet(port, securePort int) error {
|
|||
return fmt.Errorf("CreateKeyspace(%v) failed: %v", *initKeyspace, err)
|
||||
}
|
||||
|
||||
// create the shard
|
||||
if err := topo.CreateShard(agent.TopoServer, *initKeyspace, shard); err != nil {
|
||||
// create the shard (it may already exist if
|
||||
// someone else just created it, this code is
|
||||
// not protected by a lock of any kind)
|
||||
if err := topo.CreateShard(agent.TopoServer, *initKeyspace, shard); err != nil && err != topo.ErrNodeExists {
|
||||
return fmt.Errorf("CreateShard(%v/%v) failed: %v", *initKeyspace, shard, err)
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче