Skip to content

Commit b1e5d61

Browse files
authored
pdutil: wait after updating region label rules (#49479)
close #49477
1 parent 3a8b5ac commit b1e5d61

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

br/pkg/pdutil/pd.go

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -967,7 +967,13 @@ func PauseSchedulersByKeyRange(
967967
pdHTTPCli pdhttp.Client,
968968
startKey, endKey []byte,
969969
) (done <-chan struct{}, err error) {
970-
return pauseSchedulerByKeyRangeWithTTL(ctx, pdHTTPCli, startKey, endKey, pauseTimeout)
970+
done, err = pauseSchedulerByKeyRangeWithTTL(ctx, pdHTTPCli, startKey, endKey, pauseTimeout)
971+
// Wait for the rule to take effect because the PD operator is processed asynchronously.
972+
// To synchronize this, checking the operator status may not be enough. For details, see
973+
// https://github.com/pingcap/tidb/issues/49477.
974+
// Let's use two times default value of `patrol-region-interval` from PD configuration.
975+
<-time.After(20 * time.Millisecond)
976+
return
971977
}
972978

973979
func pauseSchedulerByKeyRangeWithTTL(

0 commit comments

Comments
 (0)