Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ddl: retry prepare RPC when meets region error #39834

Merged
merged 9 commits into from
Dec 19, 2022
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 28 additions & 18 deletions ddl/cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -319,24 +319,34 @@ func SendPrepareFlashbackToVersionRPC(
resp, err := s.SendReq(bo, req, loc.Region, flashbackTimeout)
if err != nil {
return taskStat, err
}
regionErr, err := resp.GetRegionError()
if err != nil {
return taskStat, err
}
if regionErr != nil {
return taskStat, errors.Errorf(regionErr.String())
}
if resp.Resp == nil {
return taskStat, errors.Errorf("prepare flashback missing resp body")
}
prepareFlashbackToVersionResp := resp.Resp.(*kvrpcpb.PrepareFlashbackToVersionResponse)
if err := prepareFlashbackToVersionResp.GetError(); err != "" {
return taskStat, errors.Errorf(err)
}
taskStat.CompletedRegions++
if isLast {
break
} else {
regionErr, err := resp.GetRegionError()
if err != nil {
return taskStat, err
}
if regionErr != nil {
err = bo.Backoff(tikv.BoRegionMiss(), errors.New(regionErr.String()))
if err != nil {
return taskStat, err
}
continue
}
if resp.Resp == nil {
logutil.BgLogger().Warn("prepare flashback miss resp body", zap.Uint64("region_id", loc.Region.GetID()))
err = bo.Backoff(tikv.BoTiKVRPC(), errors.New("prepare flashback rpc miss resp body"))
if err != nil {
return taskStat, err
}
continue
}
flashbackToVersionResp := resp.Resp.(*kvrpcpb.FlashbackToVersionResponse)
Defined2014 marked this conversation as resolved.
Show resolved Hide resolved
if respErr := flashbackToVersionResp.GetError(); respErr != "" {
boErr := bo.Backoff(tikv.BoTiKVRPC(), errors.New(respErr))
if boErr != nil {
return taskStat, boErr
}
continue
}
}
bo = tikv.NewBackoffer(ctx, flashbackMaxBackoff)
startKey = endKey
Expand Down