diff --git a/br/pkg/pdutil/pd.go b/br/pkg/pdutil/pd.go index 3ddd3155cc7b9..d7921d4c7bf7e 100644 --- a/br/pkg/pdutil/pd.go +++ b/br/pkg/pdutil/pd.go @@ -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 { diff --git a/br/pkg/restore/split.go b/br/pkg/restore/split.go index 4a38c5348d087..61bb70a5d0031 100644 --- a/br/pkg/restore/split.go +++ b/br/pkg/restore/split.go @@ -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}) diff --git a/br/pkg/restore/split_client.go b/br/pkg/restore/split_client.go index 0b3037e3c9749..3364a27244fbc 100755 --- a/br/pkg/restore/split_client.go +++ b/br/pkg/restore/split_client.go @@ -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 {