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

pdutil: wait after updating region label rules #49479

Merged
merged 10 commits into from
Dec 21, 2023
5 changes: 5 additions & 0 deletions br/pkg/pdutil/pd.go
Original file line number Diff line number Diff line change
Expand Up @@ -971,6 +971,11 @@ func (p *PdController) CreateOrUpdateRegionLabelRule(ctx context.Context, rule L
_, lastErr = pdRequest(ctx, addr, pdhttp.RegionLabelRule,
p.cli, http.MethodPost, reqData)
if lastErr == nil {
// Wait for the rule to take effect because the PD operator is processed asynchronously.
// To synchronize this, checking the operator status may not be enough. For details, see
// https://github.com/pingcap/tidb/issues/49477.
// Let's use two times default value of `patrol-region-interval` from PD configuration.
<-time.After(20 * time.Millisecond)
return nil
}
if berrors.IsContextCanceled(lastErr) {
Expand Down