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

The limit of scatter range scheduler is not right #3356

Closed
rleungx opened this issue Jan 13, 2021 · 0 comments · Fixed by #3361
Closed

The limit of scatter range scheduler is not right #3356

rleungx opened this issue Jan 13, 2021 · 0 comments · Fixed by #3361
Assignees
Labels
severity/major type/bug The issue is confirmed as a bug.

Comments

@rleungx
Copy link
Member

rleungx commented Jan 13, 2021

Bug Report

func (l *scatterRangeScheduler) IsScheduleAllowed(cluster opt.Cluster) bool {
return l.OpController.OperatorCount(operator.OpRange) < cluster.GetOpts().GetRegionScheduleLimit()
}
func (l *scatterRangeScheduler) Schedule(cluster opt.Cluster) []*operator.Operator {
schedulerCounter.WithLabelValues(l.GetName(), "schedule").Inc()
// isolate a new cluster according to the key range
c := schedule.GenRangeCluster(cluster, l.config.GetStartKey(), l.config.GetEndKey())
c.SetTolerantSizeRatio(2)
ops := l.balanceLeader.Schedule(c)
if len(ops) > 0 {
ops[0].SetDesc(fmt.Sprintf("scatter-range-leader-%s", l.config.RangeName))
ops[0].AttachKind(operator.OpRange)
ops[0].Counters = append(ops[0].Counters,
schedulerCounter.WithLabelValues(l.GetName(), "new-operator"),
schedulerCounter.WithLabelValues(l.GetName(), "new-leader-operator"))
return ops
}
ops = l.balanceRegion.Schedule(c)
if len(ops) > 0 {
ops[0].SetDesc(fmt.Sprintf("scatter-range-region-%s", l.config.RangeName))
ops[0].AttachKind(operator.OpRange)
ops[0].Counters = append(ops[0].Counters,
schedulerCounter.WithLabelValues(l.GetName(), "new-operator"),
schedulerCounter.WithLabelValues(l.GetName(), "new-region-operator"),
)
return ops
}
schedulerCounter.WithLabelValues(l.GetName(), "no-need").Inc()
return nil
}

We use region limit here to decide if the scatter range scheduler can schedule but actually, we also use this scheduler to scatter leader which needs to be considered.

BTW, OpRange here is not very useful. IMO, we can remove it and directly use OpRegion.

What version of PD are you using (pd-server -V)?

master (ca53ac6)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
severity/major type/bug The issue is confirmed as a bug.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants