Skip to content

Commit

Permalink
br: increased PD time out (#37598)
Browse files Browse the repository at this point in the history
close #37549
  • Loading branch information
YuJuncen authored Sep 5, 2022
1 parent be48447 commit 376d319
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 1 deletion.
4 changes: 3 additions & 1 deletion br/pkg/pdutil/pd.go
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,9 @@ func NewPdController(
pdClient, err := pd.NewClientWithContext(
ctx, addrs, securityOption,
pd.WithGRPCDialOptions(maxCallMsgSize...),
pd.WithCustomTimeoutOption(10*time.Second),
// If the time too short, we may scatter a region many times, because
// the interface `ScatterRegions` may time out.
pd.WithCustomTimeoutOption(60*time.Second),
pd.WithMaxErrorRetry(3),
)
if err != nil {
Expand Down
3 changes: 3 additions & 0 deletions br/pkg/restore/split.go
Original file line number Diff line number Diff line change
Expand Up @@ -387,6 +387,9 @@ func (rs *RegionSplitter) ScatterRegions(ctx context.Context, newRegions []*Regi
})
return nil
}
if err != nil {
log.Warn("scatter region meet error", logutil.ShortError(err))
}
return err
// the retry is for the temporary network errors during sending request.
}, &exponentialBackoffer{attempt: 3, baseBackoff: 500 * time.Millisecond})
Expand Down
3 changes: 3 additions & 0 deletions br/pkg/restore/split_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,9 @@ func (c *pdClient) ScatterRegions(ctx context.Context, regionInfo []*RegionInfo)
regionsID := make([]uint64, 0, len(regionInfo))
for _, v := range regionInfo {
regionsID = append(regionsID, v.Region.Id)
log.Debug("scattering regions", logutil.Key("start", v.Region.StartKey),
logutil.Key("end", v.Region.EndKey),
zap.Uint64("id", v.Region.Id))
}
resp, err := c.client.ScatterRegions(ctx, regionsID)
if err != nil {
Expand Down

0 comments on commit 376d319

Please sign in to comment.